<!DOCTYPE html>
<html lang="en-US">
    <head>
        <title>Math::MatrixReal - Matrix of Reals - metacpan.org</title>
        <link rel="preload" as="fetch" href="https://metacpan.org/account/login_status" crossorigin="anonymous" />
        <link href="https://metacpan.org/_assets/b8ccceeed47a0652049703d99326a9cea4933443.css" rel="stylesheet" type="text/css">
        <script src="https://metacpan.org/_assets/6bfedafe2d7caa915b7d84f61b45936818e3242e.js" type="text/javascript" defer></script>
        <link rel="alternate" type="application/rss+xml" title="Recent CPAN Uploads of Math-MatrixReal - MetaCPAN" href="https://metacpan.org/dist/Math-MatrixReal/releases.rss" />
        <link rel="canonical" href="./Math::MatrixReal.html" />
        <meta name="description" content="Matrix of Reals" />
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5">
        <link rel="shortcut icon" href="https://metacpan.org/static/icons/favicon.ico">
        <link rel="apple-touch-icon" sizes="152x152" href="https://metacpan.org/static/icons/apple-touch-icon.png">
        <link rel="search" href="https://metacpan.org/static/opensearch.xml" type="application/opensearchdescription+xml" title="MetaCPAN">
        <script>
          (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
          (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
          m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
          })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

          (function(skey, ga_id){
            ga('create', ga_id, {
              siteSpeedSampleRate : 100,
              storage             : 'none',
              clientId            : localStorage.getItem(skey)
            });
            ga(function(tracker) {
              localStorage.setItem(skey, tracker.get('clientId'));
            });
            ga('send', 'pageview');
          })('ga:clientId', 'UA-27829474-1');
        </script>
<meta name="twitter:card"        content="summary" />
<meta name="twitter:url"         content="https://metacpan.org/pod/Math::MatrixReal" />
<meta name="twitter:title"       content="Math::MatrixReal" />
<meta name="twitter:description" content="Matrix of Reals" />
<meta name="twitter:site"        content="metacpan" />
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="header-logo-large hidden-xs">
              <a href="https://metacpan.org/" tabindex="0">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#logo" />
                </svg>
              </a>
            </div>
            <div class="header-logo-icon visible-xs">
              <a href="https://metacpan.org/">
                <svg class="logo" aria-label="MetaCPAN">
                  <use class="logo" href="/static/images/metacpan-logo.svg#dots" />
                </svg>
              </a>
            </div>
            <ul class="nav navbar-nav menu-items hidden-xs hidden-sm">
              <li><a href="https://metacpan.org/about">About</a></li>
              <li><a href="https://metacpan.org/about/sponsors">Sponsor</a></li>
              <li><a href="https://grep.metacpan.org/">grep::cpan</a></li>
              <li><a href="https://metacpan.org/recent">Recent</a></li>
              <li><a href="https://metacpan.org/about/faq">FAQ</a></li>
              <li><a href="https://metacpan.org/tools">Tools</a></li>
              <li><a href="https://fastapi.metacpan.org/">API</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <button type="button" class="searchbar-btn visible-xs visible-sm">
                    <i class="fa fa-search button-fa-icon"></i>
                </button>
                <form action="https://metacpan.org/search" class="searchbar-form visible-md visible-lg search-form form-horizontal">
                   <input type="hidden" name="size" id="metacpan_search-size" value="20">
                  <div class="form-group">
                      <div class="search-group">
                        <i class="fa fa-search"></i>
                        <input type="text" name="q" placeholder="Search the CPAN" size="41" autocorrect="off" autocapitalize="off" spellcheck="false" id="metacpan_search-input" class="form-control" value="">
                      </div>
                  </div>
                </form>
                    <li class="icon-slidepanel visible-xs visible-sm">
                      <button data-toggle="slidepanel" data-target=".slidepanel">
                        <span class="button-fa-icon">
                          <i class="fa fa-bars slidepanel-open"></i>
                          <i class="fa fa-times slidepanel-close"></i>
                        </span>
                      </button>
                    </li>
                <form action="https://metacpan.org/account/logout" method="POST" id="metacpan-logout"></form>
                <li class="dropdown logged_in" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon logged-in-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li><a href="https://metacpan.org/account/identities">Identities</a></li>
                        <li><a href="https://metacpan.org/account/profile">Profile</a></li>
                        <li><a href="https://metacpan.org/account/favorite/list">Favorites</a></li>
                        <li>
                            <a href="./Math::MatrixReal.html#" type="button" onclick="$('#metacpan-logout').submit(); return false">
                              Logout
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_out" style="display: none;">
                    <button type="button" class="dropdown-toggle" data-toggle="dropdown">
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                      <i class="fas fa-chevron-down"></i>
                    </button>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="https://metacpan.org/login/github">
                                <i class="fab fa-github fa-fw"></i>
                                GitHub
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/twitter">
                                <i class="fab fa-twitter fa-fw"></i>
                                Twitter
                            </a>
                        </li>
                        <li>
                            <a href="https://metacpan.org/login/google">
                                <i class="fab fa-google fa-fw"></i>
                                Google
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="dropdown logged_placeholder">
                    <button>
                      <i class="fa fa-user button-fa-icon" aria-hidden="true"></i>
                    </button>
                </li>
            </ul>
        </nav>
        <div class="page-content ">
          <!--
          <div class="top-notify-banner">
            <i class="fas fa-info-circle"></i>
          </div>
          -->
          <nav class="sidebar">
            <div class="slidepanel">
              <ul class="nav-list ">
    <li class="nav-header no-margin-top">
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The date that this version of Math-MatrixReal was released.">
      <span class="relatize">25 Sep 2016 19:05:41 UTC</span>
    </li>
  <li>
    Distribution: <a href="https://metacpan.org/dist/Math-MatrixReal">Math-MatrixReal</a>
  </li>
  <li>
    Module version: 2.13
  </li>
  <li>
    <a data-keyboard-shortcut="g s" href="https://metacpan.org/dist/Math-MatrixReal/source/lib/Math/MatrixReal.pm">Source</a>
    (<a href="https://metacpan.org/dist/Math-MatrixReal/source/lib/Math/MatrixReal.pm?raw=1">raw</a>)
  </li>
  <li>
    <a data-keyboard-shortcut="g b" href="https://metacpan.org/dist/Math-MatrixReal/source/lib/Math">Browse</a>
    (<a href="https://metacpan.org/dist/Math-MatrixReal/source/lib/Math?raw=1">raw</a>)
  </li>
    <li>
      <a data-keyboard-shortcut="g c" href="https://metacpan.org/dist/Math-MatrixReal/changes">Changes</a>
    </li>
    <li>
      <a class="nopopup" href="https://metacpan.org/dist/Math-MatrixReal/contribute">How to Contribute</a>
    </li>
    <li>
        <a rel="noopener nofollow" data-keyboard-shortcut="g r" href="https://github.com/leto/math--matrixreal">Repository</a>
    </li>
    <li>
      <a rel="noopener nofollow" data-keyboard-shortcut="g i" href="https://rt.cpan.org/Public/Dist/Display.html?Name=Math-MatrixReal">Issues</a>
      (7)
    </li>
    <li>
      <a rel="noopener nofollow" href="http://matrix.cpantesters.org/?dist=Math-MatrixReal+2.13" title="Matrix">Testers</a>
        <span title="(pass / fail / na)">(<a rel="noopener nofollow" href="https://www.cpantesters.org/distro/M/Math-MatrixReal.html?oncpan=1&amp;distmat=1&amp;version=2.13&amp;grade=2" style="color: #090">2889</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/M/Math-MatrixReal.html?oncpan=1&amp;distmat=1&amp;version=2.13&amp;grade=3" style="color: #900">61</a> / <a rel="noopener nofollow" href="https://www.cpantesters.org/distro/M/Math-MatrixReal.html?oncpan=1&amp;distmat=1&amp;version=2.13&amp;grade=4">0</a>)</span>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpants.cpanauthors.org/release/LETO/Math-MatrixReal-2.13">Kwalitee</a>
    </li>
    <li>
      <div class="ttip" data-toggle="tooltip" data-placement="bottom" title="The # people with an indexing permission on Math-MatrixReal who have released something to CPAN in the last 2 years (i.e. the # people likely able to release critical fixes in a timely manner)">
      Bus factor: 0
      </div>
    </li>
    <li>
      <a rel="noopener nofollow" href="http://cpancover.com/latest/Math-MatrixReal-2.13/index.html">72.25% Coverage </a>
    </li>
    <li>
      License: perl_5
    </li>
    <li class="nav-header">Activity</li>
    <li>
<div class="activity-graph">
    <img src="https://metacpan.org/dist/Math-MatrixReal/activity.svg?res=month" />
    <div class="comment">24 month</div>
</div>
    </li>
    <li class="nav-header">Tools</li>
    <li>
      <a itemprop="downloadUrl" href="https://cpan.metacpan.org/authors/id/L/LE/LETO/Math-MatrixReal-2.13.tar.gz">
      Download (<span itemprop="fileSize">147.94KB</span>)</a>
    </li>
    <li>
      <a href="https://explorer.metacpan.org/?url=%2Fmodule%2FLETO%2FMath-MatrixReal-2.13%2Flib%2FMath%2FMatrixReal.pm">
        MetaCPAN Explorer
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Math-MatrixReal/permissions">
        Permissions
      </a>
    </li>
    <li>
      <a href="https://metacpan.org/dist/Math-MatrixReal/releases.rss">
        Subscribe to distribution
      </a>
    </li>
    <li>
      <button class="btn btn-link" data-toggle="modal" data-target="#metacpan_install-instructions-dialog">
        Install Instructions
      </button>
    </li>
    <li>
      <form action="https://metacpan.org/search">
        <input type="hidden" name="q" value="dist:Math-MatrixReal">
        <input type="search" name="q" placeholder="Search distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
      </form>
    </li>
    <li>
      <form action="https://grep.metacpan.org/search">
        <input type="hidden" name="qd" value="Math-MatrixReal">
        <input type="hidden" name="source" value="metacpan">
        <input type="search" name="q" placeholder="grep distribution" class="form-control tool-bar-form">
        <input type="submit" style="display: none">
     </form>
    </li>
    <li class="version-jump">
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Math/MatrixReal.pm&#39;" class="form-control tool-bar-form">
  <option disabled selected>Jump to version</option>
<option
  disabled
  value="LETO/Math-MatrixReal-2.13"
>2.13
  (LETO on 2016-09-25)</option>
<option
  
  value="LETO/Math-MatrixReal-2.12"
>2.12
  (LETO on 2014-12-28)</option>
<optgroup label="BackPAN">'
<option
  
  value="LETO/Math-MatrixReal-2.11"
>2.11
  (LETO on 2014-01-03)</option>
<option
  
  value="LETO/Math-MatrixReal-2.10"
>2.10
  (LETO on 2013-11-20)</option>
<option
  
  value="LETO/Math-MatrixReal-2.09"
>2.09
  (LETO on 2011-11-05)</option>
<option
  
  value="LETO/Math-MatrixReal-2.08"
>2.08
  (LETO on 2011-04-11)</option>
<option
  
  value="LETO/Math-MatrixReal-2.05"
>2.05
  (LETO on 2008-03-01)</option>
<option
  
  value="LETO/Math-MatrixReal-2.04"
>2.04
  (LETO on 2008-02-24)</option>
<option
  
  value="LETO/Math-MatrixReal-2.03"
>2.03
  (LETO on 2008-01-27)</option>
<option
  
  value="LETO/Math-MatrixReal-2.02"
>2.02
  (LETO on 2007-06-10)</option>
<option
  
  value="LETO/Math-MatrixReal-2.01"
>2.01
  (LETO on 2005-08-20)</option>
<option
  
  value="LETO/Math-MatrixReal-1.11"
>1.11
  (LETO on 2005-08-19)</option>
<option
  
  value="LETO/Math-MatrixReal-1.10"
>1.10
  (LETO on 2005-08-19)</option>
<option
  
  value="LETO/Math-MatrixReal-1.9"
>1.9
  (LETO on 2002-05-15)</option>
<option
  
  value="LETO/Math-MatrixReal-1.8"
>1.8
  (LETO on 2002-03-23)</option>
<option
  
  value="LETO/Math-MatrixReal-1.7"
>1.7
  (LETO on 2002-03-15)</option>
<option
  
  value="LETO/Math-MatrixReal-1.6"
>1.6
  (LETO on 2002-02-16)</option>
<option
  
  value="LETO/Math-MatrixReal-1.5"
>1.5
  (LETO on 2002-01-12)</option>
<option
  
  value="LETO/Math-MatrixReal-1.4"
>1.4
  (LETO on 2002-01-10)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.3a5"
>1.3a5
  (STBEY on 1999-11-09)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.2"
>1.2
  (STBEY on 1997-03-23)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.1"
>1.1
  (STBEY on 1997-02-05)</option>
<option
  
  value="ANDK/Math-MatrixReal-1.1"
>1.1
  (ANDK on 1997-02-04)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.0"
>1.0
  (STBEY on 1997-01-12)</option>
</optgroup>
</select>
    </li>
    <li class="version-diff">
<select onchange="document.location.href='/release/LETO/Math-MatrixReal-2.13/diff/' + encodeURIComponent(this.value) + '/lib/Math/MatrixReal.pm'
" class="form-control tool-bar-form">
  <option disabled selected>Diff with version</option>
<option
  disabled
  value="LETO/Math-MatrixReal-2.13"
>2.13
  (LETO on 2016-09-25)</option>
<option
  
  value="LETO/Math-MatrixReal-2.12"
>2.12
  (LETO on 2014-12-28)</option>
<optgroup label="BackPAN">'
<option
  
  value="LETO/Math-MatrixReal-2.11"
>2.11
  (LETO on 2014-01-03)</option>
<option
  
  value="LETO/Math-MatrixReal-2.10"
>2.10
  (LETO on 2013-11-20)</option>
<option
  
  value="LETO/Math-MatrixReal-2.09"
>2.09
  (LETO on 2011-11-05)</option>
<option
  
  value="LETO/Math-MatrixReal-2.08"
>2.08
  (LETO on 2011-04-11)</option>
<option
  
  value="LETO/Math-MatrixReal-2.05"
>2.05
  (LETO on 2008-03-01)</option>
<option
  
  value="LETO/Math-MatrixReal-2.04"
>2.04
  (LETO on 2008-02-24)</option>
<option
  
  value="LETO/Math-MatrixReal-2.03"
>2.03
  (LETO on 2008-01-27)</option>
<option
  
  value="LETO/Math-MatrixReal-2.02"
>2.02
  (LETO on 2007-06-10)</option>
<option
  
  value="LETO/Math-MatrixReal-2.01"
>2.01
  (LETO on 2005-08-20)</option>
<option
  
  value="LETO/Math-MatrixReal-1.11"
>1.11
  (LETO on 2005-08-19)</option>
<option
  
  value="LETO/Math-MatrixReal-1.10"
>1.10
  (LETO on 2005-08-19)</option>
<option
  
  value="LETO/Math-MatrixReal-1.9"
>1.9
  (LETO on 2002-05-15)</option>
<option
  
  value="LETO/Math-MatrixReal-1.8"
>1.8
  (LETO on 2002-03-23)</option>
<option
  
  value="LETO/Math-MatrixReal-1.7"
>1.7
  (LETO on 2002-03-15)</option>
<option
  
  value="LETO/Math-MatrixReal-1.6"
>1.6
  (LETO on 2002-02-16)</option>
<option
  
  value="LETO/Math-MatrixReal-1.5"
>1.5
  (LETO on 2002-01-12)</option>
<option
  
  value="LETO/Math-MatrixReal-1.4"
>1.4
  (LETO on 2002-01-10)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.3a5"
>1.3a5
  (STBEY on 1999-11-09)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.2"
>1.2
  (STBEY on 1997-03-23)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.1"
>1.1
  (STBEY on 1997-02-05)</option>
<option
  
  value="ANDK/Math-MatrixReal-1.1"
>1.1
  (ANDK on 1997-02-04)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.0"
>1.0
  (STBEY on 1997-01-12)</option>
</optgroup>
</select>
    </li>

    <li>
<ul class="dependencies">
  <li class="nav-header">Dependencies</li>
  <li><i class="ttip" title="dynamic_config enabled">unknown</i></li>
  <li>
    <hr>
  </li>
  <li>
    <a href="https://metacpan.org/module/Math::MatrixReal/requires">Reverse dependencies</a>
  </li>
  <li>
    <a href="http://deps.cpantesters.org/?module=Math%3A%3AMatrixReal">CPAN Testers List</a>
  </li>
  <li>
    <a href="https://cpandeps.grinnz.com/?dist=Math-MatrixReal">Dependency graph</a>
  </li>
</ul>
    </li>
    <li class="nav-header">Permalinks</li>
    <li>
      <a href="https://metacpan.org/release/LETO/Math-MatrixReal-2.13/view/lib/Math/MatrixReal.pm">This version</a>
    </li>
    <li>
      <a href="./Math::MatrixReal.html">Latest version</a>
    </li>
    <li>
<div class="plussers">
<div class="nav-header">++ed by:</div>
<div>
<a class="display-all" href="https://metacpan.org/author/SREZIC"><img src="https://www.gravatar.com/avatar/5fa5a4e5ffdf883a1fcb1840c915d485?d=identicon&amp;s=20" title="SREZIC" alt="SREZIC"></a>
<a class="display-all" href="https://metacpan.org/author/KEEDI"><img src="https://www.gravatar.com/avatar/95f905a7a4ccc573c711e9d264c0fde8?d=identicon&amp;s=20" title="KEEDI" alt="KEEDI"></a>
<a class="display-all" href="https://metacpan.org/author/DMOL"><img src="https://www.gravatar.com/avatar/78b28a931707c0fa696996adc7702db9?d=identicon&amp;s=20" title="DMOL" alt="DMOL"></a>
</div>
<!-- Display counts of plussers-->
<div>
    <a href="https://metacpan.org/dist/Math-MatrixReal/plussers">3 PAUSE users</a>
</div>
<div>
    3 non-PAUSE users
</div>
</div>
    </li>
    <li>
    </li>
              </ul>
            </div>
          </nav>
          <div class="content-navigation">
<div class="breadcrumbs">
  <span>
    <a data-keyboard-shortcut="g a" rel="author" href="https://metacpan.org/author/LETO" class="author-name">Jonathan Leto</a>
  </span>
  <span>&nbsp;/&nbsp;</span>
  <div class="release dist-release status-latest maturity-released">
    <span class="dropdown"><b class="caret"></b></span>
<select onchange="document.location.href=&#39;/release/&#39;+this.value+&#39;/view/lib/Math/MatrixReal.pm&#39;" class="">
<option
  selected
  value="LETO/Math-MatrixReal-2.13"
>2.13
  (LETO on 2016-09-25)</option>
<option
  
  value="LETO/Math-MatrixReal-2.12"
>2.12
  (LETO on 2014-12-28)</option>
<optgroup label="BackPAN">'
<option
  
  value="LETO/Math-MatrixReal-2.11"
>2.11
  (LETO on 2014-01-03)</option>
<option
  
  value="LETO/Math-MatrixReal-2.10"
>2.10
  (LETO on 2013-11-20)</option>
<option
  
  value="LETO/Math-MatrixReal-2.09"
>2.09
  (LETO on 2011-11-05)</option>
<option
  
  value="LETO/Math-MatrixReal-2.08"
>2.08
  (LETO on 2011-04-11)</option>
<option
  
  value="LETO/Math-MatrixReal-2.05"
>2.05
  (LETO on 2008-03-01)</option>
<option
  
  value="LETO/Math-MatrixReal-2.04"
>2.04
  (LETO on 2008-02-24)</option>
<option
  
  value="LETO/Math-MatrixReal-2.03"
>2.03
  (LETO on 2008-01-27)</option>
<option
  
  value="LETO/Math-MatrixReal-2.02"
>2.02
  (LETO on 2007-06-10)</option>
<option
  
  value="LETO/Math-MatrixReal-2.01"
>2.01
  (LETO on 2005-08-20)</option>
<option
  
  value="LETO/Math-MatrixReal-1.11"
>1.11
  (LETO on 2005-08-19)</option>
<option
  
  value="LETO/Math-MatrixReal-1.10"
>1.10
  (LETO on 2005-08-19)</option>
<option
  
  value="LETO/Math-MatrixReal-1.9"
>1.9
  (LETO on 2002-05-15)</option>
<option
  
  value="LETO/Math-MatrixReal-1.8"
>1.8
  (LETO on 2002-03-23)</option>
<option
  
  value="LETO/Math-MatrixReal-1.7"
>1.7
  (LETO on 2002-03-15)</option>
<option
  
  value="LETO/Math-MatrixReal-1.6"
>1.6
  (LETO on 2002-02-16)</option>
<option
  
  value="LETO/Math-MatrixReal-1.5"
>1.5
  (LETO on 2002-01-12)</option>
<option
  
  value="LETO/Math-MatrixReal-1.4"
>1.4
  (LETO on 2002-01-10)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.3a5"
>1.3a5
  (STBEY on 1999-11-09)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.2"
>1.2
  (STBEY on 1997-03-23)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.1"
>1.1
  (STBEY on 1997-02-05)</option>
<option
  
  value="ANDK/Math-MatrixReal-1.1"
>1.1
  (ANDK on 1997-02-04)</option>
<option
  
  value="STBEY/Math-MatrixReal-1.0"
>1.0
  (STBEY on 1997-01-12)</option>
</optgroup>
</select>
    <a data-keyboard-shortcut="g d" class="release-name" href="https://metacpan.org/dist/Math-MatrixReal">Math-MatrixReal-2.13</a>
  </div>
<span class="river-gauge-gauge">
  <svg width="24px"
       height="15px"
       version="1.1"
       xmlns="http://www.w3.org/2000/svg"
       xmlns:xlink="http://www.w3.org/1999/xlink">

    <g>
      <title>        River stage two &#10;
          • 8 direct dependents &#10;          • 22 total dependents
      </title>

      <rect x="0"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="5"  y="0" width="4" height="15" fill="#7ea3f2" />
      <rect x="10"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="15"  y="0" width="4" height="15" fill="#e4e2e2" />
      <rect x="20"  y="0" width="4" height="15" fill="#e4e2e2" />
    </g>
  </svg>

</span>
<div id="Math-MatrixReal-fav" class="logged_in">
<form action="https://metacpan.org/account/favorite/add" style="display: inline" onsubmit="return favDistribution(this)">
    <input type="hidden" name="remove" value="0">
    <input type="hidden" name="release" value="Math-MatrixReal-2.13">
    <input type="hidden" name="author" value="LETO">
    <input type="hidden" name="distribution" value="Math-MatrixReal">
    <button type="submit" class="favorite highlight"><span>6</span> ++</button>
</form>
</div>
<div class="logged_out">
<a href="./Math::MatrixReal.html" onclick="alert('Please sign in to add favorites'); return false" class="favorite highlight">
<span>6</span> ++</a>
</div>
   / <span>Math::MatrixReal</span>
</div>
          </div>
          <main class="content">


<nav class="toc">
  <div class="toc-header"><strong>Contents</strong></div>
<ul>
  <li><a href="./Math::MatrixReal.html#NAME">NAME</a></li>
  <li><a href="./Math::MatrixReal.html#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="./Math::MatrixReal.html#FUNCTIONS">FUNCTIONS</a>
    <ul>
      <li><a href="./Math::MatrixReal.html#Constructor-Methods-And-Such">Constructor Methods And Such</a></li>
      <li><a href="./Math::MatrixReal.html#Matrix-Row,-Column-and-Element-operations">Matrix Row, Column and Element operations</a></li>
      <li><a href="./Math::MatrixReal.html#Matrix-Operations">Matrix Operations</a></li>
      <li><a href="./Math::MatrixReal.html#Arithmetic-Operations">Arithmetic Operations</a></li>
      <li><a href="./Math::MatrixReal.html#Boolean-Matrix-Operations">Boolean Matrix Operations</a></li>
      <li><a href="./Math::MatrixReal.html#Eigensystems">Eigensystems</a></li>
      <li><a href="./Math::MatrixReal.html#Miscellaneous">Miscellaneous</a></li>
    </ul>
  </li>
  <li><a href="./Math::MatrixReal.html#OVERLOADED-OPERATORS">OVERLOADED OPERATORS</a>
    <ul>
      <li><a href="./Math::MatrixReal.html#SYNOPSIS1">SYNOPSIS</a></li>
      <li><a href="./Math::MatrixReal.html#DESCRIPTION">DESCRIPTION</a></li>
    </ul>
  </li>
  <li><a href="./Math::MatrixReal.html#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="./Math::MatrixReal.html#VERSION">VERSION</a></li>
  <li><a href="./Math::MatrixReal.html#AUTHORS">AUTHORS</a></li>
  <li><a href="./Math::MatrixReal.html#CREDITS">CREDITS</a></li>
  <li><a href="./Math::MatrixReal.html#COPYRIGHT">COPYRIGHT</a></li>
  <li><a href="./Math::MatrixReal.html#LICENSE-AGREEMENT">LICENSE AGREEMENT</a></li>
</ul></nav>
<div class="pod anchors">
<h1 id="NAME">NAME</h1>

<p>Math::MatrixReal - Matrix of Reals</p>

<p>Implements the data type &quot;matrix of real numbers&quot; (and consequently also &quot;vector of real numbers&quot;).</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<p>my $a = Math::MatrixReal-&gt;new_random(5, 5);</p>

<p>my $b = $a-&gt;new_random(10, 30, { symmetric=&gt;1, bounded_by=&gt;[-1,1] });</p>

<p>my $c = $b * $a ** 3;</p>

<p>my $d = $b-&gt;new_from_rows( [ [ 5, 3 ,4], [3, 4, 5], [ 2, 4, 1 ] ] );</p>

<p>print $a;</p>

<p>my $row = ($a * $b)-&gt;row(3);</p>

<p>my $col = (5*$c)-&gt;col(2);</p>

<p>my $transpose = ~$c;</p>

<p>my $transpose = $c-&gt;transpose;</p>

<p>my $inverse = $a-&gt;inverse;</p>

<p>my $inverse = 1/$a;</p>

<p>my $inverse = $a ** -1;</p>

<p>my $determinant= $a-&gt;det;</p>

<ul>

<li><p>$matrix-&gt;display_precision($integer)</p>

<p>Sets the default precision when matrices are printed or stringified. $matrix-&gt;display_precision(0) will only show the integer part of all the entries of $matrix and $matrix-&gt;display_precision() will return to the default scientific display notation. This method does not effect the precision of the calculations.</p>

</li>
</ul>

<h1 id="FUNCTIONS">FUNCTIONS</h1>

<h2 id="Constructor-Methods-And-Such"><a id="Constructor"></a>Constructor Methods And Such</h2>

<ul>

<li><p>use Math::MatrixReal;</p>

<p>Makes the methods and overloaded operators of this module available to your program.</p>

</li>
<li><p>$new_matrix = new Math::MatrixReal($rows,$columns);</p>

<p>The matrix object constructor method. A new matrix of size $rows by $columns will be created, with the value <code>0.0</code> for all elements.</p>

<p>Note that this method is implicitly called by many of the other methods in this module.</p>

</li>
<li><p>$new_matrix = $some_matrix-&gt;new($rows,$columns);</p>

<p>Another way of calling the matrix object constructor method.</p>

<p>Matrix $some_matrix is not changed by this in any way.</p>

</li>
<li><p>$new_matrix = $matrix-&gt;new_from_cols( [ $column_vector|$array_ref|$string, ... ] )</p>

<p>Creates a new matrix given a reference to an array of any of the following:</p>

<ul>

<li><p>column vectors ( n by 1 Math::MatrixReal matrices )</p>

</li>
<li><p>references to arrays</p>

</li>
<li><p>strings properly formatted to create a column with Math::MatrixReal&#39;s new_from_string command</p>

</li>
</ul>

<p>You may mix and match these as you wish. However, all must be of the same dimension--no padding happens automatically. Example:</p>

<pre><code>    my $matrix = Math::MatrixReal-&gt;new_from_cols( [ [1,2], [3,4] ] );
    print $matrix;</code></pre>

<p>will print</p>

<pre><code>    [  1.000000000000E+00  3.000000000000E+00 ]
    [  2.000000000000E+00  4.000000000000E+00 ]</code></pre>

</li>
<li><p>new_from_rows( [ $row_vector|$array_ref|$string, ... ] )</p>

<p>Creates a new matrix given a reference to an array of any of the following:</p>

<ul>

<li><p>row vectors ( 1 by n Math::MatrixReal matrices )</p>

</li>
<li><p>references to arrays</p>

</li>
<li><p>strings properly formatted to create a row with Math::MatrixReal&#39;s new_from_string command</p>

</li>
</ul>

<p>You may mix and match these as you wish. However, all must be of the same dimension--no padding happens automatically. Example:</p>

<pre><code>        my $matrix = Math::MatrixReal-&gt;new_from_rows( [ [1,2], [3,4] ] );
        print $matrix;</code></pre>

<p>will print</p>

<pre><code>        [  1.000000000000E+00  2.000000000000E+00 ]
        [  3.000000000000E+00  4.000000000000E+00 ]</code></pre>

</li>
<li><p>$new_matrix = Math::MatrixReal-&gt;new_random($rows, $cols, %options );</p>

<p>This method allows you to create a random matrix with various properties controlled by the %options matrix, which is optional. The default values of the %options matrix are { integer =&gt; 0, symmetric =&gt; 0, tridiagonal =&gt; 0, diagonal =&gt; 0, bounded_by =&gt; [0,10] } .</p>

<pre><code> Example: 

    $matrix = Math::MatrixReal-&gt;new_random(4, { diagonal =&gt; 1, integer =&gt; 1 }  );
    print $matrix;</code></pre>

<p>will print a 4x4 random diagonal matrix with integer entries between zero and ten, something like</p>

<pre><code>    [  5.000000000000E+00  0.000000000000E+00  0.000000000000E+00  0.000000000000E+00 ]
    [  0.000000000000E+00  2.000000000000E+00  0.000000000000E+00  0.000000000000E+00 ]
    [  0.000000000000E+00  0.000000000000E+00  1.000000000000E+00  0.000000000000E+00 ]
    [  0.000000000000E+00  0.000000000000E+00  0.000000000000E+00  8.000000000000E+00 ]</code></pre>

</li>
<li><p>$new_matrix = Math::MatrixReal-&gt;new_diag( $array_ref );</p>

<p>This method allows you to create a diagonal matrix by only specifying the diagonal elements. Example:</p>

<pre><code>    $matrix = Math::MatrixReal-&gt;new_diag( [ 1,2,3,4 ] );
    print $matrix;</code></pre>

<p>will print</p>

<pre><code>    [  1.000000000000E+00  0.000000000000E+00  0.000000000000E+00  0.000000000000E+00 ]
    [  0.000000000000E+00  2.000000000000E+00  0.000000000000E+00  0.000000000000E+00 ]
    [  0.000000000000E+00  0.000000000000E+00  3.000000000000E+00  0.000000000000E+00 ]
    [  0.000000000000E+00  0.000000000000E+00  0.000000000000E+00  4.000000000000E+00 ]</code></pre>

</li>
<li><p>$new_matrix = Math::MatrixReal-&gt;new_tridiag( $lower, $diag, $upper );</p>

<p>This method allows you to create a tridiagonal matrix by only specifying the lower diagonal, diagonal and upper diagonal, respectively.</p>

<pre><code>    $matrix = Math::MatrixReal-&gt;new_tridiag( [ 6, 4, 2 ], [1,2,3,4], [1, 8, 9] );
    print $matrix;</code></pre>

<p>will print</p>

<pre><code>    [  1.000000000000E+00  1.000000000000E+00  0.000000000000E+00  0.000000000000E+00 ]
    [  6.000000000000E+00  2.000000000000E+00  8.000000000000E+00  0.000000000000E+00 ]
    [  0.000000000000E+00  4.000000000000E+00  3.000000000000E+00  9.000000000000E+00 ]
    [  0.000000000000E+00  0.000000000000E+00  2.000000000000E+00  4.000000000000E+00 ]</code></pre>

</li>
<li><p>$new_matrix = Math::MatrixReal-&gt;new_from_string($string);</p>

<p>This method allows you to read in a matrix from a string (for instance, from the keyboard, from a file or from your code).</p>

<p>The syntax is simple: each row must start with &quot;<code>[ </code>&quot; and end with &quot;<code> ]\n</code>&quot; (&quot;<code>\n</code>&quot; being the newline character and &quot;<code> </code>&quot; a space or tab) and contain one or more numbers, all separated from each other by spaces or tabs.</p>

<p>Additional spaces or tabs can be added at will, but no comments.</p>

<p>Examples:</p>

<pre><code>  $string = &quot;[ 1 2 3 ]\n[ 2 2 -1 ]\n[ 1 1 1 ]\n&quot;;
  $matrix = Math::MatrixReal-&gt;new_from_string($string);
  print &quot;$matrix&quot;;</code></pre>

<p>By the way, this prints</p>

<pre><code>  [  1.000000000000E+00  2.000000000000E+00  3.000000000000E+00 ]
  [  2.000000000000E+00  2.000000000000E+00 -1.000000000000E+00 ]
  [  1.000000000000E+00  1.000000000000E+00  1.000000000000E+00 ]</code></pre>

<p>But you can also do this in a much more comfortable way using the shell-like &quot;here-document&quot; syntax:</p>

<pre><code>  $matrix = Math::MatrixReal-&gt;new_from_string(&lt;&lt;&#39;MATRIX&#39;);
  [  1  0  0  0  0  0  1  ]
  [  0  1  0  0  0  0  0  ]
  [  0  0  1  0  0  0  0  ]
  [  0  0  0  1  0  0  0  ]
  [  0  0  0  0  1  0  0  ]
  [  0  0  0  0  0  1  0  ]
  [  1  0  0  0  0  0 -1  ]
  MATRIX</code></pre>

<p>You can even use variables in the matrix:</p>

<pre><code>  $c1 =   2  /  3;
  $c2 =  -2  /  5;
  $c3 =  26  /  9;

  $matrix = Math::MatrixReal-&gt;new_from_string(&lt;&lt;&quot;MATRIX&quot;);

      [   3    2    0   ]
      [   0    3    2   ]
      [  $c1  $c2  $c3  ]

  MATRIX</code></pre>

<p>(Remember that you may use spaces and tabs to format the matrix to your taste)</p>

<p>Note that this method uses exactly the same representation for a matrix as the &quot;stringify&quot; operator &quot;&quot;: this means that you can convert any matrix into a string with <code>$string = &quot;$matrix&quot;;</code> and read it back in later (for instance from a file!).</p>

<p>Note however that you may suffer a precision loss in this process because only 13 digits are supported in the mantissa when printed!!</p>

<p>If the string you supply (or someone else supplies) does not obey the syntax mentioned above, an exception is raised, which can be caught by &quot;eval&quot; as follows:</p>

<pre><code>  print &quot;Please enter your matrix (in one line): &quot;;
  $string = &lt;STDIN&gt;;
  $string =~ s/\\n/\n/g;
  eval { $matrix = Math::MatrixReal-&gt;new_from_string($string); };
  if ($@)
  {
      print &quot;$@&quot;;
      # ...
      # (error handling)
  }
  else
  {
      # continue...
  }</code></pre>

<p>or as follows:</p>

<pre><code>  eval { $matrix = Math::MatrixReal-&gt;new_from_string(&lt;&lt;&quot;MATRIX&quot;); };
  [   3    2    0   ]
  [   0    3    2   ]
  [  $c1  $c2  $c3  ]
  MATRIX
  if ($@)
  # ...</code></pre>

<p>Actually, the method shown above for reading a matrix from the keyboard is a little awkward, since you have to enter a lot of &quot;\n&quot;&#39;s for the newlines.</p>

<p>A better way is shown in this piece of code:</p>

<pre><code>  while (1)
  {
      print &quot;\nPlease enter your matrix &quot;;
      print &quot;(multiple lines, &lt;ctrl-D&gt; = done):\n&quot;;
      eval { $new_matrix =
          Math::MatrixReal-&gt;new_from_string(join(&#39;&#39;,&lt;STDIN&gt;)); };
      if ($@)
      {
          $@ =~ s/\s+at\b.*?$//;
          print &quot;${@}Please try again.\n&quot;;
      }
      else { last; }
  }</code></pre>

<p>Possible error messages of the &quot;new_from_string()&quot; method are:</p>

<pre><code>  Math::MatrixReal::new_from_string(): syntax error in input string
  Math::MatrixReal::new_from_string(): empty input string</code></pre>

<p>If the input string has rows with varying numbers of columns, the following warning will be printed to STDERR:</p>

<pre><code>  Math::MatrixReal::new_from_string(): missing elements will be set to zero!</code></pre>

<p>If everything is okay, the method returns an object reference to the (newly allocated) matrix containing the elements you specified.</p>

</li>
<li><p>$new_matrix = $some_matrix-&gt;shadow();</p>

<p>Returns an object reference to a <b>NEW</b> but <b>EMPTY</b> matrix (filled with zero&#39;s) of the <b>SAME SIZE</b> as matrix &quot;<code>$some_matrix</code>&quot;.</p>

<p>Matrix &quot;<code>$some_matrix</code>&quot; is not changed by this in any way.</p>

</li>
<li><p>$matrix1-&gt;copy($matrix2);</p>

<p>Copies the contents of matrix &quot;<code>$matrix2</code>&quot; to an <b>ALREADY EXISTING</b> matrix &quot;<code>$matrix1</code>&quot; (which must have the same size as matrix &quot;<code>$matrix2</code>&quot;!).</p>

<p>Matrix &quot;<code>$matrix2</code>&quot; is not changed by this in any way.</p>

</li>
<li><p>$twin_matrix = $some_matrix-&gt;clone();</p>

<p>Returns an object reference to a <b>NEW</b> matrix of the <b>SAME SIZE</b> as matrix &quot;<code>$some_matrix</code>&quot;. The contents of matrix &quot;<code>$some_matrix</code>&quot; have <b>ALREADY BEEN COPIED</b> to the new matrix &quot;<code>$twin_matrix</code>&quot;. This is the method that the operator &quot;=&quot; is overloaded to when you type <code>$a = $b</code>, when <code>$a</code> and <code>$b</code> are matrices.</p>

<p>Matrix &quot;<code>$some_matrix</code>&quot; is not changed by this in any way.</p>

</li>
<li><p>$matrix = Math::MatrixReal-&gt;reshape($rows, $cols, $array_ref);</p>

<p>Return a matrix with the specified dimensions (<code>$rows</code> x <code>$cols</code>) whose elements are taken from the array reference <code>$array_ref</code>. The elements of the matrix are accessed in column-major order (like Fortran arrays are stored).</p>

<pre><code>     $matrix = Math::MatrixReal-&gt;reshape(4, 3, [1..12]);</code></pre>

<p>Creates the following matrix:</p>

<pre><code>    [ 1    5    9 ]
    [ 2    6   10 ]
    [ 3    7   11 ]
    [ 4    8   12 ]</code></pre>

</li>
</ul>

<h2 id="Matrix-Row,-Column-and-Element-operations"><a id="Matrix"></a><a id="Matrix-Row--Column-and-Element-operations"></a>Matrix Row, Column and Element operations</h2>

<ul>

<li><p>$value = $matrix-&gt;element($row,$column);</p>

<p>Returns the value of a specific element of the matrix &quot;<code>$matrix</code>&quot;, located in row &quot;<code>$row</code>&quot; and column &quot;<code>$column</code>&quot;.</p>

<p><b>NOTE:</b> Unlike Perl, matrices are indexed with base-one indexes. Thus, the first element of the matrix is placed in the <b>first</b> line, <b>first</b> column:</p>

<pre><code>    $elem = $matrix-&gt;element(1, 1); # first element of the matrix.
    </code></pre>

</li>
<li><p>$matrix-&gt;assign($row,$column,$value);</p>

<p>Explicitly assigns a value &quot;<code>$value</code>&quot; to a single element of the matrix &quot;<code>$matrix</code>&quot;, located in row &quot;<code>$row</code>&quot; and column &quot;<code>$column</code>&quot;, thereby replacing the value previously stored there.</p>

</li>
<li><p>$row_vector = $matrix-&gt;row($row);</p>

<p>This is a projection method which returns an object reference to a <b>NEW</b> matrix (which in fact is a (row) vector since it has only one row) to which row number &quot;<code>$row</code>&quot; of matrix &quot;<code>$matrix</code>&quot; has already been copied.</p>

<p>Matrix &quot;<code>$matrix</code>&quot; is not changed by this in any way.</p>

</li>
<li><p>$column_vector = $matrix-&gt;column($column);</p>

<p>This is a projection method which returns an object reference to a <b>NEW</b> matrix (which in fact is a (column) vector since it has only one column) to which column number &quot;<code>$column</code>&quot; of matrix &quot;<code>$matrix</code>&quot; has already been copied.</p>

<p>Matrix &quot;<code>$matrix</code>&quot; is not changed by this in any way.</p>

</li>
<li><p>@all_elements = $matrix-&gt;as_list;</p>

<p>Get the contents of a Math::MatrixReal object as a Perl list.</p>

<p>Example:</p>

<pre><code>   my $matrix = Math::MatrixReal-&gt;new_from_rows([ [1, 2], [3, 4] ]);
   my @list = $matrix-&gt;as_list; # 1, 2, 3, 4</code></pre>

<p>This method is suitable for use with OpenGL. For example, there is need to rotate model around X-axis to 90 degrees clock-wise. That could be achieved via:</p>

<pre><code> use Math::Trig;
 use OpenGL;
 ...;
 my $axis = [1, 0, 0];
 my $angle = 90;
 ...
 my ($x, $y, $z) = @$axis;
 my $f = $angle;
 my $cos_f = cos(deg2rad($f));
 my $sin_f = sin(deg2rad($f));
 my $rotation = Math::MatrixReal-&gt;new_from_rows([
    [$cos_f+(1-$cos_f)*$x**2,    (1-$cos_f)*$x*$y-$sin_f*$z, (1-$cos_f)*$x*$z+$sin_f*$y, 0 ],
    [(1-$cos_f)*$y*$z+$sin_f*$z, $cos_f+(1-$cos_f)*$y**2 ,   (1-$cos_f)*$y*$z-$sin_f*$x, 0 ],
    [(1-$cos_f)*$z*$x-$sin_f*$y, (1-$cos_f)*$z*$y+$sin_f*$x, $cos_f+(1-$cos_f)*$z**2    ,0 ],
    [0,                          0,                          0,                          1 ],
 ]);
 ...;
 my $model_initial = Math::MatrixReal-&gt;new_diag( [1, 1, 1, 1] ); # identity matrix
 my $model = $model_initial * $rotation;
 $model = ~$model; # OpenGL operates on transposed matrices
 my $model_oga = OpenGL::Array-&gt;new_list(GL_FLOAT, $model-&gt;as_list);
 $shader-&gt;SetMatrix(model =&gt; $model_oga); # instance of OpenGL::Shader</code></pre>

<p>See <a href="https://metacpan.org/pod/OpenGL">OpenGL</a>, <a href="https://metacpan.org/pod/OpenGL::Shader">OpenGL::Shader</a>, <a href="https://metacpan.org/pod/OpenGL::Array">OpenGL::Array</a>, <a href="https://en.wikipedia.org/wiki/Rotation_matrix">rotation matrix</a>.</p>

</li>
<li><p>$new_matrix = $matrix-&gt;each( \&amp;function );</p>

<p>Creates a new matrix by evaluating a code reference on each element of the given matrix. The function is passed the element, the row index and the column index, in that order. The value the function returns ( or the value of the last executed statement ) is the value given to the corresponding element in $new_matrix.</p>

<p>Example:</p>

<pre><code>    # add 1 to every element in the matrix
    $matrix = $matrix-&gt;each ( sub { (shift) + 1 } );</code></pre>

<p>Example:</p>

<pre><code>    my $cofactor = $matrix-&gt;each( sub { my(undef,$i,$j) = @_;
        ($i+$j) % 2 == 0 ? $matrix-&gt;minor($i,$j)-&gt;det()
        : -1*$matrix-&gt;minor($i,$j)-&gt;det();
        } );</code></pre>

<p>This code needs some explanation. For each element of $matrix, it throws away the actual value and stores the row and column indexes in $i and $j. Then it sets element [$i,$j] in $cofactor to the determinant of <code>$matrix-&gt;minor($i,$j)</code> if it is an &quot;even&quot; element, or <code>-1*$matrix-&gt;minor($i,$j)</code> if it is an &quot;odd&quot; element.</p>

</li>
<li><p>$new_matrix = $matrix-&gt;each_diag( \&amp;function );</p>

<p>Creates a new matrix by evaluating a code reference on each diagonal element of the given matrix. The function is passed the element, the row index and the column index, in that order. The value the function returns ( or the value of the last executed statement ) is the value given to the corresponding element in $new_matrix.</p>

</li>
<li><p>$matrix-&gt;swap_col( $col1, $col2 );</p>

<p>This method takes two one-based column numbers and swaps the values of each element in each column. <code>$matrix-&gt;swap_col(2,3)</code> would replace column 2 in $matrix with column 3, and replace column 3 with column 2.</p>

</li>
<li><p>$matrix-&gt;swap_row( $row1, $row2 );</p>

<p>This method takes two one-based row numbers and swaps the values of each element in each row. <code>$matrix-&gt;swap_row(2,3)</code> would replace row 2 in $matrix with row 3, and replace row 3 with row 2.</p>

</li>
<li><p>$matrix-&gt;assign_row( $row_number , $new_row_vector );</p>

<p>This method takes a one-based row number and assigns row $row_number of $matrix with $new_row_vector and returns the resulting matrix. <code>$matrix-&gt;assign_row(5, $x)</code> would replace row 5 in $matrix with the row vector $x.</p>

</li>
<li><p>$matrix-&gt;maximum(); and $matrix-&gt;minimum();</p>

<p>These two methods work similarly, one for computing the maximum element or elements from a matrix, and the minimum element or elements from a matrix. They work in a similar way as Octave/MatLab max/min functions.</p>

<p>When computing the maximum or minimum from a vector (vertical or horizontal), only one element is returned. When computing the maximum or minimum from a matrix, the maximum/minimum element for each column is returned in an array reference.</p>

<p>When called in list context, the function returns a pair, where the first element is the maximum/minimum element (or elements) and the second is the position of that value in the vector (first occurrence), or the row where it occurs, for matrices.</p>

<p>Consider the matrix and vector below for the following examples:</p>

<pre><code>           [ 1 9 4 ] 
      $A = [ 3 5 2 ]       $B = [ 8 7 9 5 3 ]
           [ 8 7 6 ]</code></pre>

<p>When used in scalar context:</p>

<pre><code>    $max = $A-&gt;maximum();    # $max = [ 8, 9, 6 ]
    $min = $B-&gt;minimum();    # $min = 3</code></pre>

<p>When used in list context:</p>

<pre><code>    ($min, $pos) = $A-&gt;minimum(); # $min = [ 1 5 2 ]
                                  # $pos = [ 1 2 2 ]
    ($max, $pos) = $B-&gt;maximum(); # $max = 9
                                  # $pos = 3</code></pre>

</li>
</ul>

<h2 id="Matrix-Operations"><a id="Matrix1"></a>Matrix Operations</h2>

<ul>

<li><p><code>$det = $matrix-&gt;det();</code></p>

<p>Returns the determinant of the matrix, without going through the rigamarole of computing a LR decomposition. This method should be much faster than LR decomposition if the matrix is diagonal or triangular. Otherwise, it is just a wrapper for <code>$matrix-&gt;decompose_LR-&gt;det_LR</code>. If the determinant is zero, there is no inverse and vice-versa. Only quadratic matrices have determinants.</p>

</li>
<li><p><code>$inverse = $matrix-&gt;inverse();</code></p>

<p>Returns the inverse of a matrix, without going through the rigamarole of computing a LR decomposition. If no inverse exists, undef is returned and an error is printed via <code>carp()</code>. This is nothing but a wrapper for <code>$matrix-&gt;decompose_LR-&gt;invert_LR</code>.</p>

</li>
<li><p><code>($rows,$columns) = $matrix-&gt;dim();</code></p>

<p>Returns a list of two items, representing the number of rows and columns the given matrix &quot;<code>$matrix</code>&quot; contains.</p>

</li>
<li><p><code>$norm_one = $matrix-&gt;norm_one();</code></p>

<p>Returns the &quot;one&quot;-norm of the given matrix &quot;<code>$matrix</code>&quot;.</p>

<p>The &quot;one&quot;-norm is defined as follows:</p>

<p>For each column, the sum of the absolute values of the elements in the different rows of that column is calculated. Finally, the maximum of these sums is returned.</p>

<p>Note that the &quot;one&quot;-norm and the &quot;maximum&quot;-norm are mathematically equivalent, although for the same matrix they usually yield a different value.</p>

<p>Therefore, you should only compare values that have been calculated using the same norm!</p>

<p>Throughout this package, the &quot;one&quot;-norm is (arbitrarily) used for all comparisons, for the sake of uniformity and comparability, except for the iterative methods &quot;solve_GSM()&quot;, &quot;solve_SSM()&quot; and &quot;solve_RM()&quot; which use either norm depending on the matrix itself.</p>

</li>
<li><p><code>$norm_max = $matrix-&gt;norm_max();</code></p>

<p>Returns the &quot;maximum&quot;-norm of the given matrix $matrix.</p>

<p>The &quot;maximum&quot;-norm is defined as follows:</p>

<p>For each row, the sum of the absolute values of the elements in the different columns of that row is calculated. Finally, the maximum of these sums is returned.</p>

<p>Note that the &quot;maximum&quot;-norm and the &quot;one&quot;-norm are mathematically equivalent, although for the same matrix they usually yield a different value.</p>

<p>Therefore, you should only compare values that have been calculated using the same norm!</p>

<p>Throughout this package, the &quot;one&quot;-norm is (arbitrarily) used for all comparisons, for the sake of uniformity and comparability, except for the iterative methods &quot;solve_GSM()&quot;, &quot;solve_SSM()&quot; and &quot;solve_RM()&quot; which use either norm depending on the matrix itself.</p>

</li>
<li><p><code>$norm_sum = $matrix-&gt;norm_sum();</code></p>

<p>This is a very simple norm which is defined as the sum of the absolute values of every element.</p>

</li>
<li><p><code>$p_norm</code> = $matrix-&gt;norm_p($n);&gt;</p>

<p>This function returns the &quot;p-norm&quot; of a vector. The argument $n must be a number greater than or equal to 1 or the string &quot;Inf&quot;. The p-norm is defined as (sum(x_i^p))^(1/p). In words, it raised each element to the p-th power, adds them up, and then takes the p-th root of that number. If the string &quot;Inf&quot; is passed, the &quot;infinity-norm&quot; is computed, which is really the limit of the p-norm as p goes to infinity. It is defined as the maximum element of the vector. Also, note that the familiar Euclidean distance between two vectors is just a special case of a p-norm, when p is equal to 2.</p>

<p>Example: $a = Math::MatrixReal-&gt;new_from_cols([[1,2,3]]); $p1 = $a-&gt;norm_p(1); $p2 = $a-&gt;norm_p(2); $p3 = $a-&gt;norm_p(3); $pinf = $a-&gt;norm_p(&quot;Inf&quot;);</p>

<pre><code>    print &quot;(1,2,3,Inf) norm:\n$p1\n$p2\n$p3\n$pinf\n&quot;;

    $i1 = $a-&gt;new_from_rows([[1,0]]);
    $i2 = $a-&gt;new_from_rows([[0,1]]);

    # this should be sqrt(2) since it is the same as the 
    # hypotenuse of a 1 by 1 right triangle

    $dist  = ($i1-$i2)-&gt;norm_p(2);
    print &quot;Distance is $dist, which should be &quot; . sqrt(2) . &quot;\n&quot;;</code></pre>

<p>Output:</p>

<pre><code>    (1,2,3,Inf) norm:
    6
    3.74165738677394139
    3.30192724889462668
    3

    Distance is 1.41421356237309505, which should be 1.41421356237309505</code></pre>

</li>
<li><p><code>$frob_norm</code> = <code>$matrix-&gt;norm_frobenius();</code></p>

<p>This norm is similar to that of a p-norm where p is 2, except it acts on a <b>matrix</b>, not a vector. Each element of the matrix is squared, this is added up, and then a square root is taken.</p>

</li>
<li><p><code>$matrix-&gt;spectral_radius();</code></p>

<p>Returns the maximum value of the absolute value of all eigenvalues. Currently this computes <b>all</b> eigenvalues, then sifts through them to find the largest in absolute value. Needless to say, this is very inefficient, and in the future an algorithm that computes only the largest eigenvalue may be implemented.</p>

</li>
<li><p><code>$matrix1-&gt;transpose($matrix2);</code></p>

<p>Calculates the transposed matrix of matrix $matrix2 and stores the result in matrix &quot;<code>$matrix1</code>&quot; (which must already exist and have the same size as matrix &quot;<code>$matrix2</code>&quot;!).</p>

<p>This operation can also be carried out &quot;in-place&quot;, i.e., input and output matrix may be identical.</p>

<p>Transposition is a symmetry operation: imagine you rotate the matrix along the axis of its main diagonal (going through elements (1,1), (2,2), (3,3) and so on) by 180 degrees.</p>

<p>Another way of looking at it is to say that rows and columns are swapped. In fact the contents of element <code>(i,j)</code> are swapped with those of element <code>(j,i)</code>.</p>

<p>Note that (especially for vectors) it makes a big difference if you have a row vector, like this:</p>

<pre><code>  [ -1 0 1 ]</code></pre>

<p>or a column vector, like this:</p>

<pre><code>  [ -1 ]
  [  0 ]
  [  1 ]</code></pre>

<p>the one vector being the transposed of the other!</p>

<p>This is especially true for the matrix product of two vectors:</p>

<pre><code>               [ -1 ]
  [ -1 0 1 ] * [  0 ]  =  [ 2 ] ,  whereas
               [  1 ]

                             *     [ -1  0  1 ]
  [ -1 ]                                            [  1  0 -1 ]
  [  0 ] * [ -1 0 1 ]  =  [ -1 ]   [  1  0 -1 ]  =  [  0  0  0 ]
  [  1 ]                  [  0 ]   [  0  0  0 ]     [ -1  0  1 ]
                          [  1 ]   [ -1  0  1 ]</code></pre>

<p>So be careful about what you really mean!</p>

<p>Hint: throughout this module, whenever a vector is explicitly required for input, a <b>COLUMN</b> vector is expected!</p>

</li>
<li><p><code>$trace = $matrix-&gt;trace();</code></p>

<p>This returns the trace of the matrix, which is defined as the sum of the diagonal elements. The matrix must be quadratic.</p>

</li>
<li><p><code>$minor = $matrix-&gt;minor($row,$col);</code></p>

<p>Returns the minor matrix corresponding to $row and $col. $matrix must be quadratic. If $matrix is n rows by n cols, the minor of $row and $col will be an (n-1) by (n-1) matrix. The minor is defined as crossing out the row and the col specified and returning the remaining rows and columns as a matrix. This method is used by <code>cofactor()</code>.</p>

</li>
<li><p><code>$cofactor = $matrix-&gt;cofactor();</code></p>

<p>The cofactor matrix is constructed as follows:</p>

<p>For each element, cross out the row and column that it sits in. Now, take the determinant of the matrix that is left in the other rows and columns. Multiply the determinant by (-1)^(i+j), where i is the row index, and j is the column index. Replace the given element with this value.</p>

<p>The cofactor matrix can be used to find the inverse of the matrix. One formula for the inverse of a matrix is the cofactor matrix transposed divided by the original determinant of the matrix.</p>

<p>The following two inverses should be exactly the same:</p>

<pre><code>    my $inverse1 = $matrix-&gt;inverse;
    my $inverse2 = ~($matrix-&gt;cofactor)-&gt;each( sub { (shift)/$matrix-&gt;det() } );</code></pre>

<p>Caveat: Although the cofactor matrix is simple algorithm to compute the inverse of a matrix, and can be used with pencil and paper for small matrices, it is comically slower than the native <code>inverse()</code> function. Here is a small benchmark:</p>

<pre><code>    # $matrix1 is 15x15
    $det = $matrix1-&gt;det;
    timethese( 10,
        {&#39;inverse&#39; =&gt; sub { $matrix1-&gt;inverse(); },
          &#39;cofactor&#39; =&gt; sub { (~$matrix1-&gt;cofactor)-&gt;each ( sub { (shift)/$det; } ) }
        } );


    Benchmark: timing 10 iterations of LR, cofactor, inverse...
        inverse:  1 wallclock secs ( 0.56 usr +  0.00 sys =  0.56 CPU) @ 17.86/s (n=10)
    cofactor: 36 wallclock secs (36.62 usr +  0.01 sys = 36.63 CPU) @  0.27/s (n=10)</code></pre>

</li>
<li><p><code>$adjoint = $matrix-&gt;adjoint();</code></p>

<p>The adjoint is just the transpose of the cofactor matrix. This method is just an alias for <code> ~($matrix-&gt;cofactor)</code>.</p>

</li>
</ul>

<ul>

<li><p><code>$part_of_matrix = $matrix-&gt;submatrix(x1,y1,x2,Y2);</code></p>

<p>Submatrix permit to select only part of existing matrix in order to produce a new one. This method take four arguments to define a selection area:</p>

<dl>

<dt id="-firstly:-Coordinate-of-top-left-corner-to-select-(x1,y1)"><a id="firstly:-Coordinate-of-top-left-corner-to-select--x1-y1"></a>- firstly: Coordinate of top left corner to select (x1,y1)</dt>
<dd>

</dd>
<dt id="-secondly:-Coordinate-of-bottom-right-corner-to-select-(x2,y2)"><a id="secondly:-Coordinate-of-bottom-right-corner-to-select--x2-y2"></a>- secondly: Coordinate of bottom right corner to select (x2,y2)</dt>
<dd>

</dd>
</dl>

<p>Example:</p>

<pre><code>    my $matrix = Math::MatrixReal-&gt;new_from_string(&lt;&lt;&#39;MATRIX&#39;);
    [  0  0  0  0  0  0  0  ]
    [  0  0  0  0  0  0  0  ]
    [  0  0  0  0  0  0  0  ]
    [  0  0  0  0  0  0  0  ]
    [  0  0  0  0  1  0  1  ]
    [  0  0  0  0  0  1  0  ]
    [  0  0  0  0  1  0  1  ]
    MATRIX
    
    my $submatrix = $matrix-&gt;submatrix(5,5,7,7);
    $submatrix-&gt;display_precision(0);
    print $submatrix;</code></pre>

<p>Output:</p>

<pre><code>    [  1  0  1  ]
    [  0  1  0  ]
    [  1  0  1  ]</code></pre>

</li>
</ul>

<h2 id="Arithmetic-Operations"><a id="Arithmetic"></a>Arithmetic Operations</h2>

<ul>

<li><p><code>$matrix1-&gt;add($matrix2,$matrix3);</code></p>

<p>Calculates the sum of matrix &quot;<code>$matrix2</code>&quot; and matrix &quot;<code>$matrix3</code>&quot; and stores the result in matrix &quot;<code>$matrix1</code>&quot; (which must already exist and have the same size as matrix &quot;<code>$matrix2</code>&quot; and matrix &quot;<code>$matrix3</code>&quot;!).</p>

<p>This operation can also be carried out &quot;in-place&quot;, i.e., the output and one (or both) of the input matrices may be identical.</p>

</li>
<li><p><code>$matrix1-&gt;subtract($matrix2,$matrix3);</code></p>

<p>Calculates the difference of matrix &quot;<code>$matrix2</code>&quot; minus matrix &quot;<code>$matrix3</code>&quot; and stores the result in matrix &quot;<code>$matrix1</code>&quot; (which must already exist and have the same size as matrix &quot;<code>$matrix2</code>&quot; and matrix &quot;<code>$matrix3</code>&quot;!).</p>

<p>This operation can also be carried out &quot;in-place&quot;, i.e., the output and one (or both) of the input matrices may be identical.</p>

<p>Note that this operation is the same as <code>$matrix1-&gt;add($matrix2,-$matrix3);</code>, although the latter is a little less efficient.</p>

</li>
<li><p><code>$matrix1-&gt;multiply_scalar($matrix2,$scalar);</code></p>

<p>Calculates the product of matrix &quot;<code>$matrix2</code>&quot; and the number &quot;<code>$scalar</code>&quot; (i.e., multiplies each element of matrix &quot;<code>$matrix2</code>&quot; with the factor &quot;<code>$scalar</code>&quot;) and stores the result in matrix &quot;<code>$matrix1</code>&quot; (which must already exist and have the same size as matrix &quot;<code>$matrix2</code>&quot;!).</p>

<p>This operation can also be carried out &quot;in-place&quot;, i.e., input and output matrix may be identical.</p>

</li>
<li><p><code>$product_matrix = $matrix1-&gt;multiply($matrix2);</code></p>

<p>Calculates the product of matrix &quot;<code>$matrix1</code>&quot; and matrix &quot;<code>$matrix2</code>&quot; and returns an object reference to a new matrix &quot;<code>$product_matrix</code>&quot; in which the result of this operation has been stored.</p>

<p>Note that the dimensions of the two matrices &quot;<code>$matrix1</code>&quot; and &quot;<code>$matrix2</code>&quot; (i.e., their numbers of rows and columns) must harmonize in the following way (example):</p>

<pre><code>                          [ 2 2 ]
                          [ 2 2 ]
                          [ 2 2 ]

              [ 1 1 1 ]   [ * * ]
              [ 1 1 1 ]   [ * * ]
              [ 1 1 1 ]   [ * * ]
              [ 1 1 1 ]   [ * * ]</code></pre>

<p>I.e., the number of columns of matrix &quot;<code>$matrix1</code>&quot; has to be the same as the number of rows of matrix &quot;<code>$matrix2</code>&quot;.</p>

<p>The number of rows and columns of the resulting matrix &quot;<code>$product_matrix</code>&quot; is determined by the number of rows of matrix &quot;<code>$matrix1</code>&quot; and the number of columns of matrix &quot;<code>$matrix2</code>&quot;, respectively.</p>

</li>
<li><p><code>$matrix1-&gt;negate($matrix2);</code></p>

<p>Calculates the negative of matrix &quot;<code>$matrix2</code>&quot; (i.e., multiplies all elements with &quot;-1&quot;) and stores the result in matrix &quot;<code>$matrix1</code>&quot; (which must already exist and have the same size as matrix &quot;<code>$matrix2</code>&quot;!).</p>

<p>This operation can also be carried out &quot;in-place&quot;, i.e., input and output matrix may be identical.</p>

</li>
<li><p><code>$matrix_to_power = $matrix1-&gt;exponent($integer);</code></p>

<p>Raises the matrix to the <code>$integer</code> power. Obviously, <code>$integer</code> must be an integer. If it is zero, the identity matrix is returned. If a negative integer is given, the inverse will be computed (if it exists) and then raised the the absolute value of <code>$integer</code>. The matrix must be quadratic.</p>

</li>
</ul>

<h2 id="Boolean-Matrix-Operations"><a id="Boolean"></a>Boolean Matrix Operations</h2>

<ul>

<li><p><code>$matrix-&gt;is_quadratic();</code></p>

<p>Returns a boolean value indicating if the given matrix is quadratic (also know as &quot;square&quot; or &quot;n by n&quot;). A matrix is quadratic if it has the same number of rows as it does columns.</p>

</li>
<li><p><code>$matrix-&gt;is_square();</code></p>

<p>This is an alias for <code>is_quadratic()</code>.</p>

</li>
<li><p><code>$matrix-&gt;is_symmetric();</code></p>

<p>Returns a boolean value indicating if the given matrix is symmetric. By definition, a matrix is symmetric if and only if (<b>M</b>[<i>i</i>,<i>j</i>]=<b>M</b>[<i>j</i>,<i>i</i>]). This is equivalent to <code>($matrix == ~$matrix)</code> but without memory allocation. Only quadratic matrices can be symmetric.</p>

<p>Notes: A symmetric matrix always has real eigenvalues/eigenvectors. A matrix plus its transpose is always symmetric.</p>

</li>
<li><p><code>$matrix-&gt;is_skew_symmetric();</code></p>

<p>Returns a boolean value indicating if the given matrix is skew symmetric. By definition, a matrix is symmetric if and only if (<b>M</b>[<i>i</i>,<i>j</i>]=<b>-M</b>[<i>j</i>,<i>i</i>]). This is equivalent to <code>($matrix == -(~$matrix))</code> but without memory allocation. Only quadratic matrices can be skew symmetric.</p>

</li>
<li><p><code>$matrix-&gt;is_diagonal();</code></p>

<p>Returns a boolean value indicating if the given matrix is diagonal, i.e. all of the nonzero elements are on the main diagonal. Only quadratic matrices can be diagonal.</p>

</li>
<li><p><code>$matrix-&gt;is_tridiagonal();</code></p>

<p>Returns a boolean value indicating if the given matrix is tridiagonal, i.e. all of the nonzero elements are on the main diagonal or the diagonals above and below the main diagonal. Only quadratic matrices can be tridiagonal.</p>

</li>
<li><p><code>$matrix-&gt;is_upper_triangular();</code></p>

<p>Returns a boolean value indicating if the given matrix is upper triangular, i.e. all of the nonzero elements not on the main diagonal are above it. Only quadratic matrices can be upper triangular. Note: diagonal matrices are both upper and lower triangular.</p>

</li>
<li><p><code>$matrix-&gt;is_lower_triangular();</code></p>

<p>Returns a boolean value indicating if the given matrix is lower triangular, i.e. all of the nonzero elements not on the main diagonal are below it. Only quadratic matrices can be lower triangular. Note: diagonal matrices are both upper and lower triangular.</p>

</li>
<li><p><code>$matrix-&gt;is_orthogonal();</code></p>

<p>Returns a boolean value indicating if the given matrix is orthogonal. An orthogonal matrix is has the property that the transpose equals the inverse of the matrix. Instead of computing each and comparing them, this method multiplies the matrix by it&#39;s transpose, and returns true if this turns out to be the identity matrix, false otherwise. Only quadratic matrices can orthogonal.</p>

</li>
<li><p><code>$matrix-&gt;is_binary();</code></p>

<p>Returns a boolean value indicating if the given matrix is binary. A matrix is binary if it contains only zeroes or ones.</p>

</li>
<li><p><code>$matrix-&gt;is_gramian();</code></p>

<p>Returns a boolean value indicating if the give matrix is Gramian. A matrix <code>$A</code> is Gramian if and only if there exists a square matrix <code>$B</code> such that <code>$A = ~$B*$B</code>. This is equivalent to checking if <code>$A</code> is symmetric and has all nonnegative eigenvalues, which is what Math::MatrixReal uses to check for this property.</p>

</li>
<li><p><code>$matrix-&gt;is_LR();</code></p>

<p>Returns a boolean value indicating if the matrix is an LR decomposition matrix.</p>

</li>
<li><p><code>$matrix-&gt;is_positive();</code></p>

<p>Returns a boolean value indicating if the matrix contains only positive entries. Note that a zero entry is not positive and will cause <code>is_positive()</code> to return false.</p>

</li>
<li><p><code>$matrix-&gt;is_negative();</code></p>

<p>Returns a boolean value indicating if the matrix contains only negative entries. Note that a zero entry is not negative and will cause <code>is_negative()</code> to return false.</p>

</li>
<li><p><code>$matrix-&gt;is_periodic($k);</code></p>

<p>Returns a boolean value indicating if the matrix is periodic with period $k. This is true if <code>$matrix ** ($k+1) == $matrix</code>. When <code>$k == 1</code>, this reduces down to the <code>is_idempotent()</code> function.</p>

</li>
<li><p><code>$matrix-&gt;is_idempotent();</code></p>

<p>Returns a boolean value indicating if the matrix is idempotent, which is defined as the square of the matrix being equal to the original matrix, i.e <code>$matrix ** 2 == $matrix</code>.</p>

</li>
<li><p><code>$matrix-&gt;is_row_vector();</code></p>

<p>Returns a boolean value indicating if the matrix is a row vector. A row vector is a matrix which is 1xn. Note that the 1x1 matrix is both a row and column vector.</p>

</li>
<li><p><code>$matrix-&gt;is_col_vector();</code></p>

<p>Returns a boolean value indicating if the matrix is a col vector. A col vector is a matrix which is nx1. Note that the 1x1 matrix is both a row and column vector.</p>

</li>
</ul>

<h2 id="Eigensystems">Eigensystems</h2>

<ul>

<li><p><code>($l, $V) = $matrix-&gt;sym_diagonalize();</code></p>

<p>This method performs the diagonalization of the quadratic <i>symmetric</i> matrix <b>M</b> stored in $matrix. On output, <b>l</b> is a column vector containing all the eigenvalues of <b>M</b> and <b>V</b> is an orthogonal matrix which columns are the corresponding normalized eigenvectors. The primary property of an eigenvalue <i>l</i> and an eigenvector <b>x</b> is of course that: <b>M</b> * <b>x</b> = <i>l</i> * <b>x</b>.</p>

<p>The method uses a Householder reduction to tridiagonal form followed by a QL algoritm with implicit shifts on this tridiagonal. (The tridiagonal matrix is kept internally in a compact form in this routine to save memory.) In fact, this routine wraps the householder() and tri_diagonalize() methods described below when their intermediate results are not desired. The overall algorithmic complexity of this technique is O(N^3). According to several books, the coefficient hidden by the &#39;O&#39; is one of the best possible for general (symmetric) matrixes.</p>

</li>
<li><p><code>($T, $Q) = $matrix-&gt;householder();</code></p>

<p>This method performs the Householder algorithm which reduces the <i>n</i> by <i>n</i> real <i>symmetric</i> matrix <b>M</b> contained in $matrix to tridiagonal form. On output, <b>T</b> is a symmetric tridiagonal matrix (only diagonal and off-diagonal elements are non-zero) and <b>Q</b> is an <i>orthogonal</i> matrix performing the tranformation between <b>M</b> and <b>T</b> (<code>$M == $Q * $T * ~$Q</code>).</p>

</li>
<li><p><code>($l, $V) = $T-&gt;tri_diagonalize([$Q]);</code></p>

<p>This method diagonalizes the symmetric tridiagonal matrix <b>T</b>. On output, $l and $V are similar to the output values described for sym_diagonalize().</p>

<p>The optional argument $Q corresponds to an orthogonal transformation matrix <b>Q</b> that should be used additionally during <b>V</b> (eigenvectors) computation. It should be supplied if the desired eigenvectors correspond to a more general symmetric matrix <b>M</b> previously reduced by the householder() method, not a mere tridiagonal. If <b>T</b> is really a tridiagonal matrix, <b>Q</b> can be omitted (it will be internally created in fact as an identity matrix). The method uses a QL algorithm (with implicit shifts).</p>

</li>
<li><p><code>$l = $matrix-&gt;sym_eigenvalues();</code></p>

<p>This method computes the eigenvalues of the quadratic <i>symmetric</i> matrix <b>M</b> stored in $matrix. On output, <b>l</b> is a column vector containing all the eigenvalues of <b>M</b>. Eigenvectors are not computed (on the contrary of <code>sym_diagonalize()</code>) and this method is more efficient (even though it uses a similar algorithm with two phases). However, understand that the algorithmic complexity of this technique is still also O(N^3). But the coefficient hidden by the &#39;O&#39; is better by a factor of..., well, see your benchmark, it&#39;s wiser.</p>

<p>This routine wraps the householder_tridiagonal() and tri_eigenvalues() methods described below when the intermediate tridiagonal matrix is not needed.</p>

</li>
<li><p><code>$T = $matrix-&gt;householder_tridiagonal();</code></p>

<p>This method performs the Householder algorithm which reduces the <i>n</i> by <i>n</i> real <i>symmetric</i> matrix <b>M</b> contained in $matrix to tridiagonal form. On output, <b>T</b> is the obtained symmetric tridiagonal matrix (only diagonal and off-diagonal elements are non-zero). The operation is similar to the householder() method, but potentially a little more efficient as the transformation matrix is not computed.</p>

</li>
<li><p>$l = $T-&gt;tri_eigenvalues();</p>

<p>This method computesthe eigenvalues of the symmetric tridiagonal matrix <b>T</b>. On output, $l is a vector containing the eigenvalues (similar to <code>sym_eigenvalues()</code>). This method is much more efficient than tri_diagonalize() when eigenvectors are not needed.</p>

</li>
</ul>

<h2 id="Miscellaneous">Miscellaneous</h2>

<ul>

<li><p>$matrix-&gt;zero();</p>

<p>Assigns a zero to every element of the matrix &quot;<code>$matrix</code>&quot;, i.e., erases all values previously stored there, thereby effectively transforming the matrix into a &quot;zero&quot;-matrix or &quot;null&quot;-matrix, the neutral element of the addition operation in a Ring.</p>

<p>(For instance the (quadratic) matrices with &quot;n&quot; rows and columns and matrix addition and multiplication form a Ring. Most prominent characteristic of a Ring is that multiplication is not commutative, i.e., in general, &quot;<code>matrix1 * matrix2</code>&quot; is not the same as &quot;<code>matrix2 * matrix1</code>&quot;!)</p>

</li>
<li><p>$matrix-&gt;one();</p>

<p>Assigns one&#39;s to the elements on the main diagonal (elements (1,1), (2,2), (3,3) and so on) of matrix &quot;<code>$matrix</code>&quot; and zero&#39;s to all others, thereby erasing all values previously stored there and transforming the matrix into a &quot;one&quot;-matrix, the neutral element of the multiplication operation in a Ring.</p>

<p>(If the matrix is quadratic (which this method doesn&#39;t require, though), then multiplying this matrix with itself yields this same matrix again, and multiplying it with some other matrix leaves that other matrix unchanged!)</p>

</li>
<li><p><code>$latex_string = $matrix-&gt;as_latex( align=&gt; &quot;c&quot;, format =&gt; &quot;%s&quot;, name =&gt; &quot;&quot; );</code></p>

<p>This function returns the matrix as a LaTeX string. It takes a hash as an argument which is used to control the style of the output. The hash element <code>align</code> may be &quot;c&quot;,&quot;l&quot; or &quot;r&quot;, corresponding to center, left and right, respectively. The <code>format</code> element is a format string that is given to <code>sprintf</code> to control the style of number format, such a floating point or scientific notation. The <code>name</code> element can be used so that a LaTeX string of &quot;$name = &quot; is prepended to the string.</p>

<p>Example:</p>

<pre><code>    my $a = Math::MatrixReal-&gt;new_from_cols([[ 1.234, 5.678, 9.1011],[1,2,3]] );
    print $a-&gt;as_latex( ( format =&gt; &quot;%.2f&quot;, align =&gt; &quot;l&quot;,name =&gt; &quot;A&quot; ) );

    Output:
    $A = $ $
    \left( \begin{array}{ll}
    1.23&amp;1.00 \\
    5.68&amp;2.00 \\
    9.10&amp;3.00
    \end{array} \right)
    $</code></pre>

</li>
<li><p><code>$yacas_string = $matrix-&gt;as_yacas( format =&gt; &quot;%s&quot;, name =&gt; &quot;&quot;, semi =&gt; 0 );</code></p>

<p>This function returns the matrix as a string that can be read by Yacas. It takes a hash as an an argument which controls the style of the output. The <code>format</code> element is a format string that is given to <code>sprintf</code> to control the style of number format, such a floating point or scientific notation. The <code>name</code> element can be used so that &quot;$name = &quot; is prepended to the string. The &lt;semi&gt; element can be set to 1 to that a semicolon is appended (so Matlab does not print out the matrix.)</p>

<p>Example:</p>

<pre><code>    $a = Math::MatrixReal-&gt;new_from_cols([[ 1.234, 5.678, 9.1011],[1,2,3]] );
    print $a-&gt;as_yacas( ( format =&gt; &quot;%.2f&quot;, align =&gt; &quot;l&quot;,name =&gt; &quot;A&quot; ) );</code></pre>

<p>Output:</p>

<pre><code>    A := {{1.23,1.00},{5.68,2.00},{9.10,3.00}}</code></pre>

</li>
<li><p><code>$matlab_string = $matrix-&gt;as_matlab( format =&gt; &quot;%s&quot;, name =&gt; &quot;&quot;, semi =&gt; 0 );</code></p>

<p>This function returns the matrix as a string that can be read by Matlab. It takes a hash as an an argument which controls the style of the output. The <code>format</code> element is a format string that is given to <code>sprintf</code> to control the style of number format, such a floating point or scientific notation. The <code>name</code> element can be used so that &quot;$name = &quot; is prepended to the string. The &lt;semi&gt; element can be set to 1 to that a semicolon is appended (so Matlab does not print out the matrix.)</p>

<p>Example:</p>

<pre><code>        my $a = Math::MatrixReal-&gt;new_from_rows([[ 1.234, 5.678, 9.1011],[1,2,3]] );
        print $a-&gt;as_matlab( ( format =&gt; &quot;%.3f&quot;, name =&gt; &quot;A&quot;,semi =&gt; 1 ) );</code></pre>

<p>Output: A = [ 1.234 5.678 9.101; 1.000 2.000 3.000];</p>

</li>
<li><p><code>$scilab_string = $matrix-&gt;as_scilab( format =&gt; &quot;%s&quot;, name =&gt; &quot;&quot;, semi =&gt; 0 );</code></p>

<p>This function is just an alias for <code>as_matlab()</code>, since both Scilab and Matlab have the same matrix format.</p>

</li>
<li><p><code>$minimum = Math::MatrixReal::min($number1,$number2);</code> <code>$minimum = Math::MatrixReal::min($matrix);</code> <code>&lt;$minimum = $matrix-</code>min;&gt;&gt;</p>

<p>Returns the minimum of the two numbers &quot;<code>number1</code>&quot; and &quot;<code>number2</code>&quot; if called with two arguments, or returns the value of the smallest element of a matrix if called with one argument or as an object method.</p>

</li>
<li><p><code>$maximum = Math::MatrixReal::max($number1,$number2);</code> <code>$maximum = Math::MatrixReal::max($number1,$number2);</code> <code>$maximum = Math::MatrixReal::max($matrix);</code> <code>&lt;$maximum = $matrix-</code>max;&gt;&gt;</p>

<p>Returns the maximum of the two numbers &quot;<code>number1</code>&quot; and &quot;<code>number2</code>&quot; if called with two arguments, or returns the value of the largest element of a matrix if called with one arguemnt or as on object method.</p>

</li>
<li><p><code>$minimal_cost_matrix = $cost_matrix-&gt;kleene();</code></p>

<p>Copies the matrix &quot;<code>$cost_matrix</code>&quot; (which has to be quadratic!) to a new matrix of the same size (i.e., &quot;clones&quot; the input matrix) and applies Kleene&#39;s algorithm to it.</p>

<p>See <a href="http://man.he.net/man3/Math::Kleene">Math::Kleene(3)</a> for more details about this algorithm!</p>

<p>The method returns an object reference to the new matrix.</p>

<p>Matrix &quot;<code>$cost_matrix</code>&quot; is not changed by this method in any way.</p>

</li>
<li><p><code>($norm_matrix,$norm_vector) = $matrix-&gt;normalize($vector);</code></p>

<p>This method is used to improve the numerical stability when solving linear equation systems.</p>

<p>Suppose you have a matrix &quot;A&quot; and a vector &quot;b&quot; and you want to find out a vector &quot;x&quot; so that <code>A * x = b</code>, i.e., the vector &quot;x&quot; which solves the equation system represented by the matrix &quot;A&quot; and the vector &quot;b&quot;.</p>

<p>Applying this method to the pair (A,b) yields a pair (A&#39;,b&#39;) where each row has been divided by (the absolute value of) the greatest coefficient appearing in that row. So this coefficient becomes equal to &quot;1&quot; (or &quot;-1&quot;) in the new pair (A&#39;,b&#39;) (all others become smaller than one and greater than minus one).</p>

<p>Note that this operation does not change the equation system itself because the same division is carried out on either side of the equation sign!</p>

<p>The method requires a quadratic (!) matrix &quot;<code>$matrix</code>&quot; and a vector &quot;<code>$vector</code>&quot; for input (the vector must be a column vector with the same number of rows as the input matrix) and returns a list of two items which are object references to a new matrix and a new vector, in this order.</p>

<p>The output matrix and vector are clones of the input matrix and vector to which the operation explained above has been applied.</p>

<p>The input matrix and vector are not changed by this in any way.</p>

<p>Example of how this method can affect the result of the methods to solve equation systems (explained immediately below following this method):</p>

<p>Consider the following little program:</p>

<pre><code>  #!perl -w

  use Math::MatrixReal qw(new_from_string);

  $A = Math::MatrixReal-&gt;new_from_string(&lt;&lt;&quot;MATRIX&quot;);
  [  1   2   3  ]
  [  5   7  11  ]
  [ 23  19  13  ]
  MATRIX

  $b = Math::MatrixReal-&gt;new_from_string(&lt;&lt;&quot;MATRIX&quot;);
  [   0   ]
  [   1   ]
  [  29   ]
  MATRIX

  $LR = $A-&gt;decompose_LR();
  if (($dim,$x,$B) = $LR-&gt;solve_LR($b))
  {
      $test = $A * $x;
      print &quot;x = \n$x&quot;;
      print &quot;A * x = \n$test&quot;;
  }

  ($A_,$b_) = $A-&gt;normalize($b);

  $LR = $A_-&gt;decompose_LR();
  if (($dim,$x,$B) = $LR-&gt;solve_LR($b_))
  {
      $test = $A * $x;
      print &quot;x = \n$x&quot;;
      print &quot;A * x = \n$test&quot;;
  }</code></pre>

<p>This will print:</p>

<pre><code>  x =
  [  1.000000000000E+00 ]
  [  1.000000000000E+00 ]
  [ -1.000000000000E+00 ]
  A * x =
  [  4.440892098501E-16 ]
  [  1.000000000000E+00 ]
  [  2.900000000000E+01 ]
  x =
  [  1.000000000000E+00 ]
  [  1.000000000000E+00 ]
  [ -1.000000000000E+00 ]
  A * x =
  [  0.000000000000E+00 ]
  [  1.000000000000E+00 ]
  [  2.900000000000E+01 ]</code></pre>

<p>You can see that in the second example (where &quot;normalize()&quot; has been used), the result is &quot;better&quot;, i.e., more accurate!</p>

</li>
<li><p><code>$LR_matrix = $matrix-&gt;decompose_LR();</code></p>

<p>This method is needed to solve linear equation systems.</p>

<p>Suppose you have a matrix &quot;A&quot; and a vector &quot;b&quot; and you want to find out a vector &quot;x&quot; so that <code>A * x = b</code>, i.e., the vector &quot;x&quot; which solves the equation system represented by the matrix &quot;A&quot; and the vector &quot;b&quot;.</p>

<p>You might also have a matrix &quot;A&quot; and a whole bunch of different vectors &quot;b1&quot;..&quot;bk&quot; for which you need to find vectors &quot;x1&quot;..&quot;xk&quot; so that <code>A * xi = bi</code>, for <code>i=1..k</code>.</p>

<p>Using Gaussian transformations (multiplying a row or column with a factor, swapping two rows or two columns and adding a multiple of one row or column to another), it is possible to decompose any matrix &quot;A&quot; into two triangular matrices, called &quot;L&quot; and &quot;R&quot; (for &quot;Left&quot; and &quot;Right&quot;).</p>

<p>&quot;L&quot; has one&#39;s on the main diagonal (the elements (1,1), (2,2), (3,3) and so so), non-zero values to the left and below of the main diagonal and all zero&#39;s in the upper right half of the matrix.</p>

<p>&quot;R&quot; has non-zero values on the main diagonal as well as to the right and above of the main diagonal and all zero&#39;s in the lower left half of the matrix, as follows:</p>

<pre><code>          [ 1 0 0 0 0 ]      [ x x x x x ]
          [ x 1 0 0 0 ]      [ 0 x x x x ]
      L = [ x x 1 0 0 ]  R = [ 0 0 x x x ]
          [ x x x 1 0 ]      [ 0 0 0 x x ]
          [ x x x x 1 ]      [ 0 0 0 0 x ]</code></pre>

<p>Note that &quot;<code>L * R</code>&quot; is equivalent to matrix &quot;A&quot; in the sense that <code>L * R * x = b &lt;==&gt; A * x = b</code> for all vectors &quot;x&quot;, leaving out of account permutations of the rows and columns (these are taken care of &quot;magically&quot; by this module!) and numerical errors.</p>

<p>Trick:</p>

<p>Because we know that &quot;L&quot; has one&#39;s on its main diagonal, we can store both matrices together in the same array without information loss! I.e.,</p>

<pre><code>                 [ R R R R R ]
                 [ L R R R R ]
            LR = [ L L R R R ]
                 [ L L L R R ]
                 [ L L L L R ]</code></pre>

<p>Beware, though, that &quot;LR&quot; and &quot;<code>L * R</code>&quot; are not the same!!!</p>

<p>Note also that for the same reason, you cannot apply the method &quot;normalize()&quot; to an &quot;LR&quot; decomposition matrix. Trying to do so will yield meaningless rubbish!</p>

<p>(You need to apply &quot;normalize()&quot; to each pair (Ai,bi) <b>BEFORE</b> decomposing the matrix &quot;Ai&#39;&quot;!)</p>

<p>Now what does all this help us in solving linear equation systems?</p>

<p>It helps us because a triangular matrix is the next best thing that can happen to us besides a diagonal matrix (a matrix that has non-zero values only on its main diagonal - in which case the solution is trivial, simply divide &quot;<code>b[i]</code>&quot; by &quot;<code>A[i,i]</code>&quot; to get &quot;<code>x[i]</code>&quot;!).</p>

<p>To find the solution to our problem &quot;<code>A * x = b</code>&quot;, we divide this problem in parts: instead of solving <code>A * x = b</code> directly, we first decompose &quot;A&quot; into &quot;L&quot; and &quot;R&quot; and then solve &quot;<code>L * y = b</code>&quot; and finally &quot;<code>R * x = y</code>&quot; (motto: divide and rule!).</p>

<p>From the illustration above it is clear that solving &quot;<code>L * y = b</code>&quot; and &quot;<code>R * x = y</code>&quot; is straightforward: we immediately know that <code>y[1] = b[1]</code>. We then deduce swiftly that</p>

<pre><code>  y[2] = b[2] - L[2,1] * y[1]</code></pre>

<p>(and we know &quot;<code>y[1]</code>&quot; by now!), that</p>

<pre><code>  y[3] = b[3] - L[3,1] * y[1] - L[3,2] * y[2]</code></pre>

<p>and so on.</p>

<p>Having effortlessly calculated the vector &quot;y&quot;, we now proceed to calculate the vector &quot;x&quot; in a similar fashion: we see immediately that <code>x[n] = y[n] / R[n,n]</code>. It follows that</p>

<pre><code>  x[n-1] = ( y[n-1] - R[n-1,n] * x[n] ) / R[n-1,n-1]</code></pre>

<p>and</p>

<pre><code>  x[n-2] = ( y[n-2] - R[n-2,n-1] * x[n-1] - R[n-2,n] * x[n] )
           / R[n-2,n-2]</code></pre>

<p>and so on.</p>

<p>You can see that - especially when you have many vectors &quot;b1&quot;..&quot;bk&quot; for which you are searching solutions to <code>A * xi = bi</code> - this scheme is much more efficient than a straightforward, &quot;brute force&quot; approach.</p>

<p>This method requires a quadratic matrix as its input matrix.</p>

<p>If you don&#39;t have that many equations, fill up with zero&#39;s (i.e., do nothing to fill the superfluous rows if it&#39;s a &quot;fresh&quot; matrix, i.e., a matrix that has been created with &quot;new()&quot; or &quot;shadow()&quot;).</p>

<p>The method returns an object reference to a new matrix containing the matrices &quot;L&quot; and &quot;R&quot;.</p>

<p>The input matrix is not changed by this method in any way.</p>

<p>Note that you can &quot;copy()&quot; or &quot;clone()&quot; the result of this method without losing its &quot;magical&quot; properties (for instance concerning the hidden permutations of its rows and columns).</p>

<p>However, as soon as you are applying any method that alters the contents of the matrix, its &quot;magical&quot; properties are stripped off, and the matrix immediately reverts to an &quot;ordinary&quot; matrix (with the values it just happens to contain at that moment, be they meaningful as an ordinary matrix or not!).</p>

</li>
<li><p><code>($dimension,$x_vector,$base_matrix) = $LR_matrix</code><code>-&gt;</code><code>solve_LR($b_vector);</code></p>

<p>Use this method to actually solve an equation system.</p>

<p>Matrix &quot;<code>$LR_matrix</code>&quot; must be a (quadratic) matrix returned by the method &quot;decompose_LR()&quot;, the LR decomposition matrix of the matrix &quot;A&quot; of your equation system <code>A * x = b</code>.</p>

<p>The input vector &quot;<code>$b_vector</code>&quot; is the vector &quot;b&quot; in your equation system <code>A * x = b</code>, which must be a column vector and have the same number of rows as the input matrix &quot;<code>$LR_matrix</code>&quot;.</p>

<p>The method returns a list of three items if a solution exists or an empty list otherwise (!).</p>

<p>Therefore, you should always use this method like this:</p>

<pre><code>  if ( ($dim,$x_vec,$base) = $LR-&gt;solve_LR($b_vec) )
  {
      # do something with the solution...
  }
  else
  {
      # do something with the fact that there is no solution...
  }</code></pre>

<p>The three items returned are: the dimension &quot;<code>$dimension</code>&quot; of the solution space (which is zero if only one solution exists, one if the solution is a straight line, two if the solution is a plane, and so on), the solution vector &quot;<code>$x_vector</code>&quot; (which is the vector &quot;x&quot; of your equation system <code>A * x = b</code>) and a matrix &quot;<code>$base_matrix</code>&quot; representing a base of the solution space (a set of vectors which put up the solution space like the spokes of an umbrella).</p>

<p>Only the first &quot;<code>$dimension</code>&quot; columns of this base matrix actually contain entries, the remaining columns are all zero.</p>

<p>Now what is all this stuff with that &quot;base&quot; good for?</p>

<p>The output vector &quot;x&quot; is <b>ALWAYS</b> a solution of your equation system <code>A * x = b</code>.</p>

<p>But also any vector &quot;<code>$vector</code>&quot;</p>

<pre><code>  $vector = $x_vector-&gt;clone();

  $machine_infinity = 1E+99; # or something like that

  for ( $i = 1; $i &lt;= $dimension; $i++ )
  {
      $vector += rand($machine_infinity) * $base_matrix-&gt;column($i);
  }</code></pre>

<p>is a solution to your problem <code>A * x = b</code>, i.e., if &quot;<code>$A_matrix</code>&quot; contains your matrix &quot;A&quot;, then</p>

<pre><code>  print abs( $A_matrix * $vector - $b_vector ), &quot;\n&quot;;</code></pre>

<p>should print a number around 1E-16 or so!</p>

<p>By the way, note that you can actually calculate those vectors &quot;<code>$vector</code>&quot; a little more efficient as follows:</p>

<pre><code>  $rand_vector = $x_vector-&gt;shadow();

  $machine_infinity = 1E+99; # or something like that

  for ( $i = 1; $i &lt;= $dimension; $i++ )
  {
      $rand_vector-&gt;assign($i,1, rand($machine_infinity) );
  }

  $vector = $x_vector + ( $base_matrix * $rand_vector );</code></pre>

<p>Note that the input matrix and vector are not changed by this method in any way.</p>

</li>
<li><p><code>$inverse_matrix = $LR_matrix-&gt;invert_LR();</code></p>

<p>Use this method to calculate the inverse of a given matrix &quot;<code>$LR_matrix</code>&quot;, which must be a (quadratic) matrix returned by the method &quot;decompose_LR()&quot;.</p>

<p>The method returns an object reference to a new matrix of the same size as the input matrix containing the inverse of the matrix that you initially fed into &quot;decompose_LR()&quot; <b>IF THE INVERSE EXISTS</b>, or an empty list otherwise.</p>

<p>Therefore, you should always use this method in the following way:</p>

<pre><code>  if ( $inverse_matrix = $LR-&gt;invert_LR() )
  {
      # do something with the inverse matrix...
  }
  else
  {
      # do something with the fact that there is no inverse matrix...
  }</code></pre>

<p>Note that by definition (disregarding numerical errors), the product of the initial matrix and its inverse (or vice-versa) is always a matrix containing one&#39;s on the main diagonal (elements (1,1), (2,2), (3,3) and so on) and zero&#39;s elsewhere.</p>

<p>The input matrix is not changed by this method in any way.</p>

</li>
<li><p><code>$condition = $matrix-&gt;condition($inverse_matrix);</code></p>

<p>In fact this method is just a shortcut for</p>

<pre><code>  abs($matrix) * abs($inverse_matrix)</code></pre>

<p>Both input matrices must be quadratic and have the same size, and the result is meaningful only if one of them is the inverse of the other (for instance, as returned by the method &quot;invert_LR()&quot;).</p>

<p>The number returned is a measure of the &quot;condition&quot; of the given matrix &quot;<code>$matrix</code>&quot;, i.e., a measure of the numerical stability of the matrix.</p>

<p>This number is always positive, and the smaller its value, the better the condition of the matrix (the better the stability of all subsequent computations carried out using this matrix).</p>

<p>Numerical stability means for example that if</p>

<pre><code>  abs( $vec_correct - $vec_with_error ) &lt; $epsilon</code></pre>

<p>holds, there must be a &quot;<code>$delta</code>&quot; which doesn&#39;t depend on the vector &quot;<code>$vec_correct</code>&quot; (nor &quot;<code>$vec_with_error</code>&quot;, by the way) so that</p>

<pre><code>  abs( $matrix * $vec_correct - $matrix * $vec_with_error ) &lt; $delta</code></pre>

<p>also holds.</p>

</li>
<li><p><code>$determinant = $LR_matrix-&gt;det_LR();</code></p>

<p>Calculates the determinant of a matrix, whose LR decomposition matrix &quot;<code>$LR_matrix</code>&quot; must be given (which must be a (quadratic) matrix returned by the method &quot;decompose_LR()&quot;).</p>

<p>In fact the determinant is a by-product of the LR decomposition: It is (in principle, that is, except for the sign) simply the product of the elements on the main diagonal (elements (1,1), (2,2), (3,3) and so on) of the LR decomposition matrix.</p>

<p>(The sign is taken care of &quot;magically&quot; by this module)</p>

</li>
<li><p><code>$order = $LR_matrix-&gt;order_LR();</code></p>

<p>Calculates the order (called &quot;Rang&quot; in German) of a matrix, whose LR decomposition matrix &quot;<code>$LR_matrix</code>&quot; must be given (which must be a (quadratic) matrix returned by the method &quot;decompose_LR()&quot;).</p>

<p>This number is a measure of the number of linear independent row and column vectors (= number of linear independent equations in the case of a matrix representing an equation system) of the matrix that was initially fed into &quot;decompose_LR()&quot;.</p>

<p>If &quot;n&quot; is the number of rows and columns of the (quadratic!) matrix, then &quot;n - order&quot; is the dimension of the solution space of the associated equation system.</p>

</li>
<li><p><code>$rank = $LR_matrix-&gt;rank_LR();</code></p>

<p>This is an alias for the <code>order_LR()</code> function. The &quot;order&quot; is usually called the &quot;rank&quot; in the United States.</p>

</li>
<li><p><code>$scalar_product = $vector1-&gt;scalar_product($vector2);</code></p>

<p>Returns the scalar product of vector &quot;<code>$vector1</code>&quot; and vector &quot;<code>$vector2</code>&quot;.</p>

<p>Both vectors must be column vectors (i.e., a matrix having several rows but only one column).</p>

<p>This is a (more efficient!) shortcut for</p>

<pre><code>  $temp           = ~$vector1 * $vector2;
  $scalar_product =  $temp-&gt;element(1,1);</code></pre>

<p>or the sum <code>i=1..n</code> of the products <code>vector1[i] * vector2[i]</code>.</p>

<p>Provided none of the two input vectors is the null vector, then the two vectors are orthogonal, i.e., have an angle of 90 degrees between them, exactly when their scalar product is zero, and vice-versa.</p>

</li>
<li><p><code>$vector_product = $vector1-&gt;vector_product($vector2);</code></p>

<p>Returns the vector product of vector &quot;<code>$vector1</code>&quot; and vector &quot;<code>$vector2</code>&quot;.</p>

<p>Both vectors must be column vectors (i.e., a matrix having several rows but only one column).</p>

<p>Currently, the vector product is only defined for 3 dimensions (i.e., vectors with 3 rows); all other vectors trigger an error message.</p>

<p>In 3 dimensions, the vector product of two vectors &quot;x&quot; and &quot;y&quot; is defined as</p>

<pre><code>              |  x[1]  y[1]  e[1]  |
  determinant |  x[2]  y[2]  e[2]  |
              |  x[3]  y[3]  e[3]  |</code></pre>

<p>where the &quot;<code>x[i]</code>&quot; and &quot;<code>y[i]</code>&quot; are the components of the two vectors &quot;x&quot; and &quot;y&quot;, respectively, and the &quot;<code>e[i]</code>&quot; are unity vectors (i.e., vectors with a length equal to one) with a one in row &quot;i&quot; and zero&#39;s elsewhere (this means that you have numbers and vectors as elements in this matrix!).</p>

<p>This determinant evaluates to the rather simple formula</p>

<pre><code>  z[1] = x[2] * y[3] - x[3] * y[2]
  z[2] = x[3] * y[1] - x[1] * y[3]
  z[3] = x[1] * y[2] - x[2] * y[1]</code></pre>

<p>A characteristic property of the vector product is that the resulting vector is orthogonal to both of the input vectors (if neither of both is the null vector, otherwise this is trivial), i.e., the scalar product of each of the input vectors with the resulting vector is always zero.</p>

</li>
<li><p><code>$length = $vector-&gt;length();</code></p>

<p>This is actually a shortcut for</p>

<pre><code>  $length = sqrt( $vector-&gt;scalar_product($vector) );</code></pre>

<p>and returns the length of a given column or row vector &quot;<code>$vector</code>&quot;.</p>

<p>Note that the &quot;length&quot; calculated by this method is in fact the &quot;two&quot;-norm (also know as the Euclidean norm) of a vector &quot;<code>$vector</code>&quot;!</p>

<p>The general definition for norms of vectors is the following:</p>

<pre><code>  sub vector_norm
  {
      croak &quot;Usage: \$norm = \$vector-&gt;vector_norm(\$n);&quot;
        if (@_ != 2);

      my($vector,$n) = @_;
      my($rows,$cols) = ($vector-&gt;[1],$vector-&gt;[2]);
      my($k,$comp,$sum);

      croak &quot;Math::MatrixReal::vector_norm(): vector is not a column vector&quot;
        unless ($cols == 1);

      croak &quot;Math::MatrixReal::vector_norm(): norm index must be &gt; 0&quot;
        unless ($n &gt; 0);

      croak &quot;Math::MatrixReal::vector_norm(): norm index must be integer&quot;
        unless ($n == int($n));

      $sum = 0;
      for ( $k = 0; $k &lt; $rows; $k++ )
      {
          $comp = abs( $vector-&gt;[0][$k][0] );
          $sum += $comp ** $n;
      }
      return( $sum ** (1 / $n) );
  }</code></pre>

<p>Note that the case &quot;n = 1&quot; is the &quot;one&quot;-norm for matrices applied to a vector, the case &quot;n = 2&quot; is the euclidian norm or length of a vector, and if &quot;n&quot; goes to infinity, you have the &quot;infinity&quot;- or &quot;maximum&quot;-norm for matrices applied to a vector!</p>

</li>
<li><p><code>$xn_vector = $matrix-&gt;</code><code>solve_GSM($x0_vector,$b_vector,$epsilon);</code></p>

</li>
<li><p><code>$xn_vector = $matrix-&gt;</code><code>solve_SSM($x0_vector,$b_vector,$epsilon);</code></p>

</li>
<li><p><code>$xn_vector = $matrix-&gt;</code><code>solve_RM($x0_vector,$b_vector,$weight,$epsilon);</code></p>

<p>In some cases it might not be practical or desirable to solve an equation system &quot;<code>A * x = b</code>&quot; using an analytical algorithm like the &quot;decompose_LR()&quot; and &quot;solve_LR()&quot; method pair.</p>

<p>In fact in some cases, due to the numerical properties (the &quot;condition&quot;) of the matrix &quot;A&quot;, the numerical error of the obtained result can be greater than by using an approximative (iterative) algorithm like one of the three implemented here.</p>

<p>All three methods, GSM (&quot;Global Step Method&quot; or &quot;Gesamtschrittverfahren&quot;), SSM (&quot;Single Step Method&quot; or &quot;Einzelschrittverfahren&quot;) and RM (&quot;Relaxation Method&quot; or &quot;Relaxationsverfahren&quot;), are fix-point iterations, that is, can be described by an iteration function &quot;<code>x(t+1) = Phi( x(t) )</code>&quot; which has the property:</p>

<pre><code>  Phi(x)  =  x    &lt;==&gt;    A * x  =  b</code></pre>

<p>We can define &quot;<code>Phi(x)</code>&quot; as follows:</p>

<pre><code>  Phi(x)  :=  ( En - A ) * x  +  b</code></pre>

<p>where &quot;En&quot; is a matrix of the same size as &quot;A&quot; (&quot;n&quot; rows and columns) with one&#39;s on its main diagonal and zero&#39;s elsewhere.</p>

<p>This function has the required property.</p>

<p>Proof:</p>

<pre><code>           A * x        =   b

  &lt;==&gt;  -( A * x )      =  -b

  &lt;==&gt;  -( A * x ) + x  =  -b + x

  &lt;==&gt;  -( A * x ) + x + b  =  x

  &lt;==&gt;  x - ( A * x ) + b  =  x

  &lt;==&gt;  ( En - A ) * x + b  =  x</code></pre>

<p>This last step is true because</p>

<pre><code>  x[i] - ( a[i,1] x[1] + ... + a[i,i] x[i] + ... + a[i,n] x[n] ) + b[i]</code></pre>

<p>is the same as</p>

<pre><code>  ( -a[i,1] x[1] + ... + (1 - a[i,i]) x[i] + ... + -a[i,n] x[n] ) + b[i]</code></pre>

<p>qed</p>

<p>Note that actually solving the equation system &quot;<code>A * x = b</code>&quot; means to calculate</p>

<pre><code>        a[i,1] x[1] + ... + a[i,i] x[i] + ... + a[i,n] x[n]  =  b[i]

  &lt;==&gt;  a[i,i] x[i]  =
        b[i]
        - ( a[i,1] x[1] + ... + a[i,i] x[i] + ... + a[i,n] x[n] )
        + a[i,i] x[i]

  &lt;==&gt;  x[i]  =
        ( b[i]
            - ( a[i,1] x[1] + ... + a[i,i] x[i] + ... + a[i,n] x[n] )
            + a[i,i] x[i]
        ) / a[i,i]

  &lt;==&gt;  x[i]  =
        ( b[i] -
            ( a[i,1] x[1] + ... + a[i,i-1] x[i-1] +
              a[i,i+1] x[i+1] + ... + a[i,n] x[n] )
        ) / a[i,i]</code></pre>

<p>There is one major restriction, though: a fix-point iteration is guaranteed to converge only if the first derivative of the iteration function has an absolute value less than one in an area around the point &quot;<code>x(*)</code>&quot; for which &quot;<code>Phi( x(*) ) = x(*)</code>&quot; is to be true, and if the start vector &quot;<code>x(0)</code>&quot; lies within that area!</p>

<p>This is best verified graphically, which unfortunately is impossible to do in this textual documentation!</p>

<p>See literature on Numerical Analysis for details!</p>

<p>In our case, this restriction translates to the following three conditions:</p>

<p>There must exist a norm so that the norm of the matrix of the iteration function, <code>( En - A )</code>, has a value less than one, the matrix &quot;A&quot; may not have any zero value on its main diagonal and the initial vector &quot;<code>x(0)</code>&quot; must be &quot;good enough&quot;, i.e., &quot;close enough&quot; to the solution &quot;<code>x(*)</code>&quot;.</p>

<p>(Remember school math: the first derivative of a straight line given by &quot;<code>y = a * x + b</code>&quot; is &quot;a&quot;!)</p>

<p>The three methods expect a (quadratic!) matrix &quot;<code>$matrix</code>&quot; as their first argument, a start vector &quot;<code>$x0_vector</code>&quot;, a vector &quot;<code>$b_vector</code>&quot; (which is the vector &quot;b&quot; in your equation system &quot;<code>A * x = b</code>&quot;), in the case of the &quot;Relaxation Method&quot; (&quot;RM&quot;), a real number &quot;<code>$weight</code>&quot; best between zero and two, and finally an error limit (real number) &quot;<code>$epsilon</code>&quot;.</p>

<p>(Note that the weight &quot;<code>$weight</code>&quot; used by the &quot;Relaxation Method&quot; (&quot;RM&quot;) is <b>NOT</b> checked to lie within any reasonable range!)</p>

<p>The three methods first test the first two conditions of the three conditions listed above and return an empty list if these conditions are not fulfilled.</p>

<p>Therefore, you should always test their return value using some code like:</p>

<pre><code>  if ( $xn_vector = $A_matrix-&gt;solve_GSM($x0_vector,$b_vector,1E-12) )
  {
      # do something with the solution...
  }
  else
  {
      # do something with the fact that there is no solution...
  }</code></pre>

<p>Otherwise, they iterate until <code>abs( Phi(x) - x ) &lt; epsilon</code>.</p>

<p>(Beware that theoretically, infinite loops might result if the starting vector is too far &quot;off&quot; the solution! In practice, this shouldn&#39;t be a problem. Anyway, you can always press &lt;ctrl-C&gt; if you think that the iteration takes too long!)</p>

<p>The difference between the three methods is the following:</p>

<p>In the &quot;Global Step Method&quot; (&quot;GSM&quot;), the new vector &quot;<code>x(t+1)</code>&quot; (called &quot;y&quot; here) is calculated from the vector &quot;<code>x(t)</code>&quot; (called &quot;x&quot; here) according to the formula:</p>

<pre><code>  y[i] =
  ( b[i]
      - ( a[i,1] x[1] + ... + a[i,i-1] x[i-1] +
          a[i,i+1] x[i+1] + ... + a[i,n] x[n] )
  ) / a[i,i]</code></pre>

<p>In the &quot;Single Step Method&quot; (&quot;SSM&quot;), the components of the vector &quot;<code>x(t+1)</code>&quot; which have already been calculated are used to calculate the remaining components, i.e.</p>

<pre><code>  y[i] =
  ( b[i]
      - ( a[i,1] y[1] + ... + a[i,i-1] y[i-1] +  # note the &quot;y[]&quot;!
          a[i,i+1] x[i+1] + ... + a[i,n] x[n] )  # note the &quot;x[]&quot;!
  ) / a[i,i]</code></pre>

<p>In the &quot;Relaxation method&quot; (&quot;RM&quot;), the components of the vector &quot;<code>x(t+1)</code>&quot; are calculated by &quot;mixing&quot; old and new value (like cold and hot water), and the weight &quot;<code>$weight</code>&quot; determines the &quot;aperture&quot; of both the &quot;hot water tap&quot; as well as of the &quot;cold water tap&quot;, according to the formula:</p>

<pre><code>  y[i] =
  ( b[i]
      - ( a[i,1] y[1] + ... + a[i,i-1] y[i-1] +  # note the &quot;y[]&quot;!
          a[i,i+1] x[i+1] + ... + a[i,n] x[n] )  # note the &quot;x[]&quot;!
  ) / a[i,i]
  y[i] = weight * y[i] + (1 - weight) * x[i]</code></pre>

<p>Note that the weight &quot;<code>$weight</code>&quot; should be greater than zero and less than two (!).</p>

<p>The three methods are supposed to be of different efficiency. Experiment!</p>

<p>Remember that in most cases, it is probably advantageous to first &quot;normalize()&quot; your equation system prior to solving it!</p>

</li>
</ul>

<h1 id="OVERLOADED-OPERATORS"><a id="OVERLOADED"></a>OVERLOADED OPERATORS</h1>

<h2 id="SYNOPSIS1">SYNOPSIS</h2>

<ul>

<li><p>Unary operators:</p>

<p>&quot;<code>-</code>&quot;, &quot;<code>~</code>&quot;, &quot;<code>abs</code>&quot;, <code>test</code>, &quot;<code>!</code>&quot;, &#39;<code>&quot;&quot;</code>&#39;</p>

</li>
<li><p>Binary operators:</p>

<p>&quot;<code>.</code>&quot;</p>

<p>Binary (arithmetic) operators:</p>

<p>&quot;<code>+</code>&quot;, &quot;<code>-</code>&quot;, &quot;<code>*</code>&quot;, &quot;<code>**</code>&quot;, &quot;<code>+=</code>&quot;, &quot;<code>-=</code>&quot;, &quot;<code>*=</code>&quot;, &quot;<code>/=</code>&quot;,&quot;<code>**=</code>&quot;</p>

</li>
<li><p>Binary (relational) operators:</p>

<p>&quot;<code>==</code>&quot;, &quot;<code>!=</code>&quot;, &quot;<code>&lt;</code>&quot;, &quot;<code>&lt;=</code>&quot;, &quot;<code>&gt;</code>&quot;, &quot;<code>&gt;=</code>&quot;</p>

<p>&quot;<code>eq</code>&quot;, &quot;<code>ne</code>&quot;, &quot;<code>lt</code>&quot;, &quot;<code>le</code>&quot;, &quot;<code>gt</code>&quot;, &quot;<code>ge</code>&quot;</p>

<p>Note that the latter (&quot;<code>eq</code>&quot;, &quot;<code>ne</code>&quot;, ... ) are just synonyms of the former (&quot;<code>==</code>&quot;, &quot;<code>!=</code>&quot;, ... ), defined for convenience only.</p>

</li>
</ul>

<h2 id="DESCRIPTION">DESCRIPTION</h2>

<dl>

<dt id="&#39;.&#39;"><a id="pod"></a>&#39;.&#39;</dt>
<dd>

<p>Concatenation</p>

<p>Returns the two matrices concatenated side by side.</p>

<p>Example: $c = $a . $b;</p>

<p>For example, if</p>

<pre><code>        $a=[ 1 2 ]   $b=[ 5 6 ]         
           [ 3 4 ]      [ 7 8 ]         
then

        $c=[ 1 2 5 6 ]
           [ 3 4 7 8 ]</code></pre>

<p>Note that only matrices with the same number of rows may be concatenated.</p>

</dd>
<dt id="&#39;-&#39;"><a id="pod1"></a>&#39;-&#39;</dt>
<dd>

<p>Unary minus</p>

<p>Returns the negative of the given matrix, i.e., the matrix with all elements multiplied with the factor &quot;-1&quot;.</p>

<p>Example:</p>

<pre><code>    $matrix = -$matrix;</code></pre>

</dd>
<dt id="&#39;~&#39;"><a id="pod2"></a>&#39;~&#39;</dt>
<dd>

<p>Transposition</p>

<p>Returns the transposed of the given matrix.</p>

<p>Examples:</p>

<pre><code>    $temp = ~$vector * $vector;
    $length = sqrt( $temp-&gt;element(1,1) );

    if (~$matrix == $matrix) { # matrix is symmetric ... }</code></pre>

</dd>
<dt id="abs">abs</dt>
<dd>

<p>Norm</p>

<p>Returns the &quot;one&quot;-Norm of the given matrix.</p>

<p>Example:</p>

<pre><code>    $error = abs( $A * $x - $b );</code></pre>

</dd>
<dt id="test">test</dt>
<dd>

<p>Boolean test</p>

<p>Tests wether there is at least one non-zero element in the matrix.</p>

<p>Example:</p>

<pre><code>    if ($xn_vector) { # result of iteration is not zero ... }</code></pre>

</dd>
<dt id="&#39;!&#39;"><a id="pod3"></a>&#39;!&#39;</dt>
<dd>

<p>Negated boolean test</p>

<p>Tests wether the matrix contains only zero&#39;s.</p>

<p>Examples:</p>

<pre><code>    if (! $b_vector) { # heterogenous equation system ... }
    else             { # homogenous equation system ... }

    unless ($x_vector) { # not the null-vector! }</code></pre>

</dd>
<dt id="&#39;&quot;&quot;&quot;&quot;&#39;"><a id="pod4"></a>&#39;&quot;&quot;&quot;&quot;&#39;</dt>
<dd>

<p>&quot;Stringify&quot; operator</p>

<p>Converts the given matrix into a string.</p>

<p>Uses scientific representation to keep precision loss to a minimum in case you want to read this string back in again later with &quot;new_from_string()&quot;.</p>

<p>By default a 13-digit mantissa and a 20-character field for each element is used so that lines will wrap nicely on an 80-column screen.</p>

<p>Examples:</p>

<pre><code>    $matrix = Math::MatrixReal-&gt;new_from_string(&lt;&lt;&quot;MATRIX&quot;);
    [ 1  0 ]
    [ 0 -1 ]
    MATRIX
    print &quot;$matrix&quot;;

    [  1.000000000000E+00  0.000000000000E+00 ]
    [  0.000000000000E+00 -1.000000000000E+00 ]

    $string = &quot;$matrix&quot;;
    $test = Math::MatrixReal-&gt;new_from_string($string);
    if ($test == $matrix) { print &quot;:-)\n&quot;; } else { print &quot;:-(\n&quot;; }</code></pre>

</dd>
<dt id="&#39;+&#39;"><a id="pod5"></a>&#39;+&#39;</dt>
<dd>

<p>Addition</p>

<p>Returns the sum of the two given matrices.</p>

<p>Examples:</p>

<pre><code>    $matrix_S = $matrix_A + $matrix_B;

    $matrix_A += $matrix_B;</code></pre>

</dd>
<dt id="&#39;-&#39;1"><a id="pod6"></a>&#39;-&#39;</dt>
<dd>

<p>Subtraction</p>

<p>Returns the difference of the two given matrices.</p>

<p>Examples:</p>

<pre><code>    $matrix_D = $matrix_A - $matrix_B;

    $matrix_A -= $matrix_B;</code></pre>

<p>Note that this is the same as:</p>

<pre><code>    $matrix_S = $matrix_A + -$matrix_B;

    $matrix_A += -$matrix_B;</code></pre>

<p>(The latter are less efficient, though)</p>

</dd>
<dt id="&#39;*&#39;"><a id="pod7"></a>&#39;*&#39;</dt>
<dd>

<p>Multiplication</p>

<p>Returns the matrix product of the two given matrices or the product of the given matrix and scalar factor.</p>

<p>Examples:</p>

<pre><code>    $matrix_P = $matrix_A * $matrix_B;

    $matrix_A *= $matrix_B;

    $vector_b = $matrix_A * $vector_x;

    $matrix_B = -1 * $matrix_A;

    $matrix_B = $matrix_A * -1;

    $matrix_A *= -1;</code></pre>

</dd>
<dt id="&#39;/&#39;"><a id="pod8"></a>&#39;/&#39;</dt>
<dd>

<p>Division</p>

<p>Currently a shortcut for doing $a * $b ** -1 is $a / $b, which works for square matrices. One can also use 1/$a .</p>

</dd>
<dt id="&#39;**&#39;"><a id="pod9"></a>&#39;**&#39;</dt>
<dd>

<p>Exponentiation</p>

<p>Returns the matrix raised to an integer power. If 0 is passed, the identity matrix is returned. If a negative integer is passed, it computes the inverse (if it exists) and then raised the inverse to the absolute value of the integer. The matrix must be quadratic.</p>

<p>Examples:</p>

<pre><code>    $matrix2 = $matrix ** 2;

    $matrix **= 2;

    $inv2 = $matrix ** -2;

    $ident = $matrix ** 0;</code></pre>

</dd>
<dt id="&#39;==&#39;"><a id="pod10"></a>&#39;==&#39;</dt>
<dd>

<p>Equality</p>

<p>Tests two matrices for equality.</p>

<p>Example:</p>

<pre><code>    if ( $A * $x == $b ) { print &quot;EUREKA!\n&quot;; }</code></pre>

<p>Note that in most cases, due to numerical errors (due to the finite precision of computer arithmetics), it is a bad idea to compare two matrices or vectors this way.</p>

<p>Better use the norm of the difference of the two matrices you want to compare and compare that norm with a small number, like this:</p>

<pre><code>    if ( abs( $A * $x - $b ) &lt; 1E-12 ) { print &quot;BINGO!\n&quot;; }</code></pre>

</dd>
<dt id="&#39;!=&#39;"><a id="pod11"></a>&#39;!=&#39;</dt>
<dd>

<p>Inequality</p>

<p>Tests two matrices for inequality.</p>

<p>Example:</p>

<pre><code>    while ($x0_vector != $xn_vector) { # proceed with iteration ... }</code></pre>

<p>(Stops when the iteration becomes stationary)</p>

<p>Note that (just like with the &#39;==&#39; operator), it is usually a bad idea to compare matrices or vectors this way. Compare the norm of the difference of the two matrices with a small number instead.</p>

</dd>
<dt id="&#39;&lt;&#39;"><a id="pod12"></a>&#39;&lt;&#39;</dt>
<dd>

<p>Less than</p>

<p>Examples:</p>

<pre><code>    if ( $matrix1 &lt; $matrix2 ) { # ... }

    if ( $vector &lt; $epsilon ) { # ... }

    if ( 1E-12 &lt; $vector ) { # ... }

    if ( $A * $x - $b &lt; 1E-12 ) { # ... }</code></pre>

<p>These are just shortcuts for saying:</p>

<pre><code>    if ( abs($matrix1) &lt; abs($matrix2) ) { # ... }

    if ( abs($vector) &lt; abs($epsilon) ) { # ... }

    if ( abs(1E-12) &lt; abs($vector) ) { # ... }

    if ( abs( $A * $x - $b ) &lt; abs(1E-12) ) { # ... }</code></pre>

<p>Uses the &quot;one&quot;-norm for matrices and Perl&#39;s built-in &quot;abs()&quot; for scalars.</p>

</dd>
<dt id="&#39;&lt;=&#39;"><a id="pod13"></a>&#39;&lt;=&#39;</dt>
<dd>

<p>Less than or equal</p>

<p>As with the &#39;&lt;&#39; operator, this is just a shortcut for the same expression with &quot;abs()&quot; around all arguments.</p>

<p>Example:</p>

<pre><code>    if ( $A * $x - $b &lt;= 1E-12 ) { # ... }</code></pre>

<p>which in fact is the same as:</p>

<pre><code>    if ( abs( $A * $x - $b ) &lt;= abs(1E-12) ) { # ... }</code></pre>

<p>Uses the &quot;one&quot;-norm for matrices and Perl&#39;s built-in &quot;abs()&quot; for scalars.</p>

</dd>
<dt id="&#39;&gt;&#39;"><a id="pod14"></a>&#39;&gt;&#39;</dt>
<dd>

<p>Greater than</p>

<p>As with the &#39;&lt;&#39; and &#39;&lt;=&#39; operator, this</p>

<pre><code>    if ( $xn - $x0 &gt; 1E-12 ) { # ... }</code></pre>

<p>is just a shortcut for:</p>

<pre><code>    if ( abs( $xn - $x0 ) &gt; abs(1E-12) ) { # ... }</code></pre>

<p>Uses the &quot;one&quot;-norm for matrices and Perl&#39;s built-in &quot;abs()&quot; for scalars.</p>

</dd>
<dt id="&#39;&gt;=&#39;"><a id="pod15"></a>&#39;&gt;=&#39;</dt>
<dd>

<p>Greater than or equal</p>

<p>As with the &#39;&lt;&#39;, &#39;&lt;=&#39; and &#39;&gt;&#39; operator, the following</p>

<pre><code>    if ( $LR &gt;= $A ) { # ... }</code></pre>

<p>is simply a shortcut for:</p>

<pre><code>    if ( abs($LR) &gt;= abs($A) ) { # ... }</code></pre>

<p>Uses the &quot;one&quot;-norm for matrices and Perl&#39;s built-in &quot;abs()&quot; for scalars.</p>

</dd>
</dl>

<h1 id="SEE-ALSO"><a id="SEE"></a>SEE ALSO</h1>

<p>Math::VectorReal, Math::PARI, Math::MatrixBool, Math::Vec, DFA::Kleene, Math::Kleene, Set::IntegerRange, Set::IntegerFast .</p>

<h1 id="VERSION">VERSION</h1>

<p>This man page documents Math::MatrixReal version 2.13</p>

<p>The latest code can be found at https://github.com/leto/math--matrixreal .</p>

<h1 id="AUTHORS">AUTHORS</h1>

<p>Steffen Beyer &lt;sb@engelschall.com&gt;, Rodolphe Ortalo &lt;ortalo@laas.fr&gt;, Jonathan &quot;Duke&quot; Leto &lt;jonathan@leto.net&gt;.</p>

<p>Currently maintained by Jonathan &quot;Duke&quot; Leto, send all bugs/patches to Github Issues: https://github.com/leto/math--matrixreal/issues</p>

<h1 id="CREDITS">CREDITS</h1>

<p>Many thanks to Prof. Pahlings for stoking the fire of my enthusiasm for Algebra and Linear Algebra at the university (RWTH Aachen, Germany), and to Prof. Esser and his assistant, Mr. Jarausch, for their fascinating lectures in Numerical Analysis!</p>

<h1 id="COPYRIGHT">COPYRIGHT</h1>

<p>Copyright (c) 1996-2016 by various authors including the original developer Steffen Beyer, Rodolphe Ortalo, the current maintainer Jonathan &quot;Duke&quot; Leto and all the wonderful people in the AUTHORS file. All rights reserved.</p>

<h1 id="LICENSE-AGREEMENT"><a id="LICENSE"></a>LICENSE AGREEMENT</h1>

<p>This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself. Fuck yeah.</p>

<div class="pod-errors"><p>1 POD Error</p><div class="pod-errors-detail"><p>The following errors were encountered while parsing the POD:</p><dl><dt>Around line 4032:</dt><dd><p>&#39;=item&#39; outside of any &#39;=over&#39;</p></dd></dl></div></div></div>

<div id="metacpan_install-instructions-dialog" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">Module Install Instructions</h4>
      </div>
      <div class="modal-body">
        <p>To install Math::MatrixReal, copy and paste the appropriate command in to your terminal.</p>
        <p><a href="https://metacpan.org/dist/App-cpanminus/view/bin/cpanm">cpanm</a></p>
        <pre><code>cpanm Math::MatrixReal</code></pre>
        <p><a href="https://metacpan.org/pod/CPAN">CPAN shell</a></p>
        <pre><code>perl -MCPAN -e shell
install Math::MatrixReal</code></pre>
        <p>For more information on module installation, please visit <a href="https://www.cpan.org/modules/INSTALL.html">the detailed CPAN module installation guide</a>.</p>
      </div>
      <div class="modal-footer">
        <a href="./Math::MatrixReal.html#" data-dismiss="modal" class="btn">Close</a>
      </div>
    </div>
  </div>
</div>
          </main>
          <div class="content-pagination">
          </div>
        </div>
        <footer class="footer">
          <div class="footer-container">
            <div class="footer-social">
              <div class="footer-link footer-logo">
                <a href="https://metacpan.org/">
                  <img src="https://metacpan.org/static/images/metacpan-logo.svg" alt="MetaCPAN" />
                </a>
              </div>
              <a class="footer-social-link" href="https://github.com/metacpan">
                <i class="fab fa-github-square"></i>
              </a>
              <a class="footer-social-link" href="https://fosstodon.org/@metacpan">
                <i class="fab fa-mastodon"></i>
              </a>
            </div>
            <div class="footer-links">
              <div class="footer-link">
                  <a href="https://metacpan.org/about">About</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/sponsors">Sponsor</a>
              </div>
              <div class="footer-link">
                  <a href="https://grep.metacpan.org">grep::cpan</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/recent">Recent</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/about/faq">FAQ</a>
              </div>
              <div class="footer-link">
                  <a href="https://metacpan.org/tools">Tools</a>
              </div>
              <div class="footer-link">
                  <a href="https://fastapi.metacpan.org/">API</a>
              </div>
              <div class="footer-link">
                  <a href="https://www.perl.org/">Perl.org</a>
              </div>
            </div>
            <div class="footer-sponsors">
              <a class="footer-sponsor-link" target="_blank" href="https://www.bytemark.co.uk/" rel="noopener">
                <img class="footer-sponsor-bytemark" src="https://metacpan.org/static/images/sponsors/bytemark_logo.svg" alt="Bytemark logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.liquidweb.com/" rel="noopener">
                <img class="footer-sponsor-liquidweb" src="https://metacpan.org/static/images/sponsors/liquidweb_logo.png" alt="liquidweb logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://deriv.com/careers/" rel="noopener">
                <img class="footer-sponsor-deriv" src="https://metacpan.org/static/images/sponsors/deriv.svg" alt="Deriv logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://geocode.xyz" rel="noopener">
                <img class="footer-sponsor-geocode" src="https://metacpan.org/static/images/sponsors/geocodelogo.svg" alt="Geocode logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://www.fastly.com/" rel="noopener">
                <img class="footer-sponsor-fastly" src="https://metacpan.org/static/images/sponsors/fastly_logo.svg" alt="Fastly logo">
              </a>
              <a class="footer-sponsor-link" target="_blank" href="https://opencagedata.com" rel="noopener">
                <img class="footer-sponsor-opencage" src="https://metacpan.org/static/images/sponsors/open-cage.svg" alt="OpenCage logo">
              </a>
            </div>
          </div>
        </footer>
        <div class="modal fade" tabindex="-1" role="dialog" id="metacpan_keyboard-shortcuts">
          <div class="modal-dialog">
            <div class="modal-content">
              <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Keyboard Shortcuts</h4>
              </div>
              <div class="modal-body row">
<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Global</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>s</kbd>
        </td>
        <td>Focus search bar</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>?</kbd>
        </td>
        <td>Bring up this help dialog</td>
      </tr>
    </tbody>
  </table>

  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>GitHub</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>p</kbd>
        </td>
        <td>Go to pull requests</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>go to github issues (only if github is preferred repository)</td>
      </tr>
    </tbody>
  </table>
</div>

<div class="col-md-6">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>POD</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>a</kbd>
        </td>
        <td>Go to author</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>c</kbd>
        </td>
        <td>Go to changes</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>i</kbd>
        </td>
        <td>Go to issues</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>d</kbd>
        </td>
        <td>Go to dist</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>r</kbd>
        </td>
        <td>Go to repository/SCM</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>s</kbd>
        </td>
        <td>Go to source</td>
      </tr>
      <tr>
        <td class="keys">
          <kbd>g</kbd> <kbd>b</kbd>
        </td>
        <td>Go to file browse</td>
      </tr>

    </tbody>
  </table>
</div>

<div class="col-md-12">
  <table class="table keyboard-shortcuts">
    <thead>
      <tr>
        <th></th>
        <th>Search terms</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td><em>module:</em> (e.g. <a href="https://metacpan.org/search?q=module%3APlugin">module:Plugin</a>)</td>
      </tr>
      <tr>
        <td><em>distribution:</em> (e.g. <a href="https://metacpan.org/search?q=distribution%3ADancer+auth">distribution:Dancer auth</a>)</td>
      </tr>
      <tr>
        <td><em>author:</em> (e.g. <a href="https://metacpan.org/search?q=author%3ASONGMU+Redis">author:SONGMU Redis</a>)</td>
      </tr>
      <tr>
        <td><em>version:</em> (e.g. <a href="https://metacpan.org/search?q=version%3A1.00">version:1.00</a>)</td>
      </tr>
    </tbody>
  </table>
</div>
              </div>
              <div class="modal-footer"></div>
            </div>
          </div>
        </div>
    </body>
</html>
